Слияние двух или более массивов с использованием array_merge()
Синтаксис: array array_merge($array1, $array2, ......, $arrayn)
Вот вашкод:
<?php
$array1 = array(
array(
'link' => 'student',
'values' => '1',
'dates' => '01'
),
array(
'link' => 'student',
'values' => '2',
'dates' => '02'
)
);
$array2 = array(
array(
'link' => 'professor',
'values' => '1',
'dates' => '01'
),
array(
'link' => 'professor',
'values' => '2',
'dates' => '02'
)
);
$array3 = array(
array(
'link' => 'classes',
'values' => '1',
'dates' => '01'
),
array(
'link' => 'classes',
'values' => '2',
'dates' => '02'
)
);
$res = array_merge($array1, $array2, $array3);
echo '<pre>';
print_r($res);
?>
Выход:
Array
(
[0] => Array
(
[link] => student
[values] => 1
[dates] => 01
)
[1] => Array
(
[link] => student
[values] => 2
[dates] => 02
)
[2] => Array
(
[link] => professor
[values] => 1
[dates] => 01
)
[3] => Array
(
[link] => professor
[values] => 2
[dates] => 02
)
[4] => Array
(
[link] => classes
[values] => 1
[dates] => 01
)
[5] => Array
(
[link] => classes
[values] => 2
[dates] => 02
)
)