I have a variable number of multidimensional arrays but all with the same 4 possible values for each item.
For example:
Array
(
[companyid] => 1
[employeeid] => 1
[role] => "Something"
[name] => "Something"
)
but every array may have a different ammount of items inside it.
I want to turn all the arrays into one single table with lots of rows. I tried array_merge() but I end up with a table with 8, 12, 16… columns instead of more rows.
So… any ideas?
Thanks
Didn’t test it, but you could try the following:
This should work since the documentation about array_merge say:
So you either get the value of the current item or a default value that you can specify in the
$columnsarray.