- var_dump: documentation ( source)
- array_shift: documentation ( source)
- explode: documentation ( source)
<?php
$c = ['one'=>['two' =>['t' => false]]];
$p = explode('.', 'one.two.tree');
$v = true;
$cf = &$c;
// Look for the key, creating nested keys if needed
while ($part = array_shift($p)) {
if (!isset($cf[$part]) && count($p)) {
$cf[$part] = array();
}
$cf = &$cf[$part];
}
$cf = $v;
var_dump($cf, $c);