It is necessary to replace the array values with others, the array can be any nesting. Can I do this by reference using recursion? The code is simply an example, the purpose of which is to change 'three' to 'five' using recursion.
$a=['one'=>['two'=>'three']]; function test($array) { foreach ($array as $k=>&$v) { if(is_array($v)) { test($v); } else { $v = 'five'; } } unset($v); } test($a); print_r($a);