note 73515 deleted from function.in-array by danbrown
| From: | danbrown@php.net | Date: | Mon, 08 Jun 2009 21:43:55 +0000 |
| Subject: | note 73515 deleted from function.in-array by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-156510@lists.php.net to get a copy of this message | ||
Note Submitter: ben
----
Becareful :
$os = array ("Mac", "NT", "Irix", "Linux");
if ( in_array(0, $os ) )
echo 1 ;
else
echo 2 ;
This code will return 1 instead of 2 as you would waiting for.
So don't forget to add the TRUE parameter :
if ( in_array(0, $os ) )
echo 1 ;
else
echo 2 ;
Thie time it will return 2.