The string
$string = \'a.b.c.d\';
should create an array like
array(\'a\' => array(\'b\' => array( ....
I managed
This should work:
function create_array(&$arr,$string,$data){ $a=explode('.',$string); $last=count($a)-1; $p=&$arr; foreach($a as $k=>$key){ if ($k==$last) { $p[$key]=$data; } else if (is_array($p)){ $p[$key]=array(); } $p=&$p[$key]; } }