note 71926 added to function.array-keys

From: Date: Sat, 23 Dec 2006 02:25:05 +0000
Subject: note 71926 added to function.array-keys
Groups: php.notes 
Request: Send a blank email to php-notes+get-120870@lists.php.net to get a copy of this message
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) ?> ---- Server IP: 60.191.90.110 Probable Submitter: 218.17.173.109 ---- Manual Page -- http://www.php.net/manual/en/function.array-keys.php Edit -- https://master.php.net/note/edit/71926 Del: integrated -- https://master.php.net/note/delete/71926/integrated Del: useless -- https://master.php.net/note/delete/71926/useless Del: bad code -- https://master.php.net/note/delete/71926/bad+code Del: spam -- https://master.php.net/note/delete/71926/spam Del: non-english -- https://master.php.net/note/delete/71926/non-english Del: in docs -- https://master.php.net/note/delete/71926/in+docs Del: other reasons-- https://master.php.net/note/delete/71926 Reject -- https://master.php.net/note/reject/71926 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#120870) next »