- var_dump: documentation ( source)
- next: documentation ( source)
<?php
function & change(&$keys,&$value, $c) {
if ($k = next($keys)) {
return change($keys,$value[$k], $c);
} else {
return $value = $c;
}
}
$keys = ['k1','k2','k3','k4'];
$hub = [];
change($keys,$hub,1);
var_dump($hub);