2014-09-18 3 views

답변

3
$keystr = 'plant,fruit,exotic'; 
$value='kiwi'; 

$arr = array(); 
$current = &$arr; 
$keys = explode(',', $keystr); 
foreach($keys as $key) { 
    $current[$key] = array(); 
    $current = &$current[$key]; 
} 
$current = $value; 
unset($current); 
var_dump($arr); 

데모에 대한 http://ideone.com/YiMIRb를 참조