note 41396 modified in function.array-search by vrana

From: Date: Tue, 17 Aug 2004 14:48:58 +0000
Subject: note 41396 modified in function.array-search by vrana
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-79855@lists.php.net to get a copy of this message
@@ apolion at loliart dot com: a thought to your example: the $key you get from your array_search is "0" (0 => 'blue'). And as for me, 0 ist the same as FALSE, so your <?php if($key == false) ?> hast to evaluate to true. after that, with the '===' -operand, you additionally compare the type of the variable and your statement evaluates to false, because 0 !== false. so everything seems to be okay for me. =) --was-- @@ apolion at loliart dot com: a thought to your example: the $key you get from your array_search is "0" (0 => 'blue'). And as for me, 0 ist the same as FALSE, so your if($key == false) hast to evaluate to true. after that, with the '===' -operand, you additionally compare the type of the variable and your statement evaluates to false, because 0 !== false. so everything seems to be okay for me. =) http://php.net/manual/en/function.array-search.php

« previous php.notes (#79855) next »