This is my array and i want 60 , 20, 39, 70,12, 29,31,72,59 in a single array. one-dimensional array.
$marks = array(
"abc" => array(
"a" => 60,
"b" => 20,
"c" => 39
),
"def" => array(
"a" => 70,
"b" => 12,
"c" => 29
),
"xyz" => array(
"a" => 31,
"b" => 72,
"c" => 59
)
);
my try was
foreach($marks as $name=>$score)
{
foreach($score as $subject=>$number)
{
$array[]= $number;
}
}
But when i am printing this array it again generate three array. on print_r($array); its showing this output.
Array ( [0] => 60 [1] => 20 [2] => 39 ) Array ( [0] => 60 [1] => 20 [2] => 39 [3] => 70 [4] => 12 [5] => 29 ) Array ( [0] => 60 [1] => 20 [2] => 39 [3] => 70 [4] => 12 [5] => 29 [6] => 31 [7] => 72 [8] => 59 )
is there any method to get only last array from the above array.or any other solution.