i have an multidimension array as given below.The array is uniform in structure
I want to make it into two arrays with even and odd keys
$array = array(
array(P0=>"a",P1=>"b",P2=>"c",P3=>"d"),
array(P0=>"e",P1=>"f",P2=>"g",P3=>"h"),
array(P0=>"k",P1=>"l",P2=>"m",P3=>"n"),
array(P0=>"0",P1=>"p",P2=>"q",P3=>"r"),
array(P0=>"s",P1=>"t",P2=>"u",P3=>"v")
);
the result should be as given below.
$array1 = array(
array(array(P0=>"a",P2=>"c"),
array(P0=>"e",P2=>"g"),
array(P0=>"k",P2=>"m"),
array(P0=>"o",P2=>"q"),
array(P0=>"s",P2=>"u")
)
$array2 = array(
array(array(P0=>"b",P2=>"d"),
array(P0=>"f",P2=>"h"),
array(P0=>"l",P2=>"n"),
array(P0=>"p",P2=>"r"),
array(P0=>"t",P2=>"v")
) ;
My code is as given below ,how to proceed..
foreach ($array as $key=>$value)
{
for($i=2; $i<count($value);$i+=2)
{
print_r($value[$i]);
}
}