note 14333 deleted from ref.array by jeroen
| From: | jeroen@php.net | Date: | Wed, 29 Aug 2001 17:55:50 +0000 |
| Subject: | note 14333 deleted from ref.array by jeroen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-17346@lists.php.net to get a copy of this message | ||
[Hm... this is stolen from a note above...]
this function makes an indexed array into a hashed array:
function arr2hash($a) {
for ($i = 0; $i < count($a); $i += 2) $ret[$a[$i]] = $a[$i+1];
return $ret;
}
$x = array("one", "two", "three", "four", "five",
"six");
$y = arr2hash($x);
echo $y["one"];