Q:

Moving particular items from multiple arrays into new arrays - PHP

I have 3 arrays:
$item_name = array( 'Apples', 'Oranges' );
$item_price = array( '29', '39' );
$item_quantity = array( '5', '10' );

What I need to do is place each item from the first and second index of each array, into it's own array (I hope that makes sense), here is an example of what I am looking to achieve:
$my_array1 = array( 'Apples', '29', '5' );
$my_array2 = array( 'Oranges', '39', '10' );

Please note that there may be more items in each array, but every array will have the same number of items.
I am stumped, is there some cheeky PHP array function, that we could use in some strange sort of way to achieve this?
Thanks for your answer.

A:

I think this migth work. All arrays need to have the same length.
$item_name = array( 'Apples', 'Oranges' );
$item_price = array( '29', '39' );
$item_quantity = array( '5', '10' );

$my_arrays = array();

foreach($item_name as $index=>$name){
   $my_arrays[$index] = array($item_name[$index], $item_price[$index], $item_quantity[$index]);
}

You will have an array my_arrays of arrays. These arrays contain the information you need.
$my_arrays[0]: ['Apples', '29', '5']
$my_arrays[1]: ['Oranges', '39', '10']

