note 107251 added to function.array-search
| From: | Anonymous | Date: | Tue, 24 Jan 2012 18:54:23 +0000 |
| Subject: | note 107251 added to function.array-search | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-185732@lists.php.net to get a copy of this message | ||
I have found that this function only works if the key is specifically defined in the array
definition. For example, this will work:
$abc = array('a'=> 0, 'b'=> 1, 'c'=>2);
$key= array_search(1, $abc);
echo $key; //Will return 'b'
However, this will NOT work:
$abc = array('a', 'b', 'c');
$key= array_search(1, $abc);
echo $key; //null
----
Server IP: 69.147.83.197
Probable Submitter: 67.53.118.2
----
Manual Page -- http://www.php.net/manual/en/function.array-search.php
Edit -- https://master.php.net/note/edit/107251
Del: integrated -- https://master.php.net/note/delete/107251/integrated
Del: useless -- https://master.php.net/note/delete/107251/useless
Del: bad code -- https://master.php.net/note/delete/107251/bad+code
Del: spam -- https://master.php.net/note/delete/107251/spam
Del: non-english -- https://master.php.net/note/delete/107251/non-english
Del: in docs -- https://master.php.net/note/delete/107251/in+docs
Del: other reasons-- https://master.php.net/note/delete/107251
Reject -- https://master.php.net/note/reject/107251
Search -- https://master.php.net/manage/user-notes.php