- ⌂ array_util
- Static Methods
array_util::merge_recursive()
Merge two or more arrays, recursively, including associative arrays.
Prototype
array merge_recursive(... $arrays)
Parameters
- arrays - Pass any number of arrays to be merged, one per parameter.
Return
An array containing recursively merged keys and values.
Example
use \io_comand_util\array_util;
// output: Some values: 4 KB, 2 KB…
$array1 = [
'people' => [
'Mary',
'Bill'
],
'places' => [
'Canada',
'United States'
]
];
$array2 = [
'places' => [
'Mexico'
]
];
$array3 = array_util::merge_recursive($array1, $array2);
echo(print_r($array3, TRUE));