I have a 2d array, say:
$array = array(
array(1, 2),
array(3, 4),
array(5, 6)
);
That's not symmetrical.
Is there a PHP function I can use that would make it into:
$array = array(
array(1, 3, 5),
array(2, 4, 6)
);
Essentially to make its rows become columns and vice versa?
I am aware it can be done via 2 foreach
's, but I am just wondering if there's an quicker and "cheaper" way.
Thank you in advance