Note that function will NOT replace a sub-tree from you $array1 if its value in $array2 is an empty array.
Even tho the key for this dimension is technically 'set'.
(I suppose it treats it as just another recursive level to dive in, finding no key to compare, backtracking while leaving this sub-tree alone)
For example:
$array1 = ['first' => ['second' => 'hello']];
$array2 = ['first' => []];
$result = array_replace_recursive($array1, $array2);
$result is still: ['first' => ['second' => 'hello']].