I have a string like this:
$string = \'one/two/three/four\';
which I turn it into a array:
$keys = explode(\'/\', $string);
$string = 'one/two/three/four';
$keys = explode('/', $string);
$arr = array(); // some big array with lots of dimensions
$ref = &$arr;
while ($key = array_shift($keys)) {
$ref = &$ref[$key];
}
$ref = 'value';
What this is doing:
$ref
, to keep track of a reference to the current dimension of $arr
.$keys
one at a time, referencing the $key
element of the current reference.