note 106265 rejected from ref.array by tularis

From: Date: Sun, 23 Oct 2011 12:48:33 +0000
Subject: note 106265 rejected from ref.array by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-184080@lists.php.net to get a copy of this message
Note Submitter: php at apieum dot com ---- Hope it help. <?php function array_expand(array $keys, $value) { if(count($keys)>0) { $key=array_pop($keys); return array_expand($keys, array($key=>$value)); } else { return $value; } } $myArray=array_expand(array('one','two','three'),'value'); var_dump($myArray); /* output : array(1) { ["one"]=> array(1) { ["two"]=> array(1) { ["three"]=> string(5) "value" } } } */ ?>

« previous php.notes (#184080) next »