Sorry for the terrible title, best I could think of at the time! Say I have a \'path\' array like so;
array(\'this\', \'is\', \'the\', \'path\')
function buildArrayFromPath( $path ) { $out = array(); while( $pop = array_pop($path) ) $out = array($pop => $out); return $out; }