I have a bit of difficulty creating some tables in a specific order from this array: $test.
The array looks like this:
Array
(
[ET5] => Array(
[0] => Array(
[0] => Array(
[total] => 430
)
)
[1] => Array(
[0] => Array(
[total] => 406
)
)
)
[FA] => Array(
[0] => Array(
[0] => Array(
[total] => 0
)
)
[1] => Array(
[0] => Array(
[total] => 0
)
)
)
[ET5] => Array(
[0] => Array(
[0] => Array(
[total] => 189
)
)
[1] => Array(
[0] => Array(
[total] => 228
)
)
)
[FA] => Array(
[0] => Array(
[0] => Array(
[total] => 0
)
)
[1] => Array(
[0] => Array(
[total] => 0
)
)
)
)
and the tables I want to create should look like this:
table1
test1 test2 test3
ET5 430 189
FA 0 0
table2
test1 test2 test3
ET5 406 228
FA 0 0
test1, test2, test3 are known strings
I’m a bit stuck on this one, notice how the values from the ET5 are in two tables.
Any ideas on this one?
You should definitely not overwrite the keys of the array like you do above.
I would separate what you want in each tables by adding them as arrays to your already multi-dimensional array…
then run your foreach loop as you would on any array: