note 122455 deleted from function.array-search by cmb
| From: | cmb@php.net | Date: | Sun, 05 Jan 2020 08:20:18 +0000 |
| Subject: | note 122455 deleted from function.array-search by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-213748@lists.php.net to get a copy of this message | ||
Note Submitter: webmaster at jaimemontoya dot com
----
Concerning how this function may return Boolean FALSE and the use of the === operator for testing
the return value of this function, see this example:
$foundKey = array_search(12345, $myArray);
if(!isset($foundKey)){
// If $myArray is null, then $foundKey will be null too.
// Do something when both $myArray and $foundKey are null.
} elseif ($foundKey===false) {
// $myArray is not null, but 12345 was not found in the $myArray array.
}else{
// 12345 was found in the $myArray array.
}