I am trying to recursively merge two arrays using array_replace_recursive. This is the code:
$col = array();
$new = array_merge_recursive($col, array('table1' => array(1 => true)));
$new = array_merge_recursive($new, array('table1' => array(0 => false)));
The dump of the $new array is
array(1) { ["table1"]=> array(2) { [1]=> bool(true) [2]=> bool(false) } }
What i need is to preserve the numeric keys of the "table1" array. The expected result should be
array(1) { ["table1"]=> array(2) { [0]=> bool(false) [1]=> bool(true) } }
Does anyone have a solution for this?
array_replace_recursiveinstead ofarray_merge_recursive.