note 71926 deleted from function.array-keys by danbrown

From: Date: Wed, 25 Aug 2010 01:48:24 +0000
Subject: note 71926 deleted from function.array-keys by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-172008@lists.php.net to get a copy of this message
Note Submitter: brettz9 a/- yah00 do/- com ---- Devmnky states that array_keys() doesn't work with multi-dimensional arrays. While it is true (as from his example), that array_keys does not recursively traverse the array for keys, one still can reference (or search for keys within) specific arrays within the array: <?php $array = array("color" => array("blue", "red", "green"), "size" => array("small", "medium", "large")); print_r(array_keys($array['color'], "blue")); // Correctly returns Array ( [0] => 0 ) (i.e., a new array starting at key 0, referring to the key of "blue" within the "color" array: 0) ?>

« previous php.notes (#172008) next »