note 68782 modified in language.operators.comparison by felipe

From: Date: Sat, 19 Jul 2008 20:32:41 +0000
Subject: note 68782 modified in language.operators.comparison by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-141724@lists.php.net to get a copy of this message
You should be very careful when using == with an result set returned from a query that can be an empty array, multi-dimensional array or a boolean false value (if the query failed to execute). In PHP, an empty array is equivalent to true. <?php $myArray = array(); // check if there is any error with the query if ($myArray == false) { echo "Yes"; } ?> return Yes Use === instead. --was-- You should be very careful when using == with an result set returned from a query that can be an empty array, multi-dimensional array or a boolean false value (if the query failed to execute). In PHP, an empty array is equivalent to true. [php] $myArray = array(); // check if there is any error with the query if ($myArray == false) { echo "Yes"; } [/php] return Yes Use === instead. http://php.net/manual/en/language.operators.comparison.php

« previous php.notes (#141724) next »