note 68782 added to language.operators.comparison

From: Date: Thu, 10 Aug 2006 16:50:17 +0000
Subject: note 68782 added to language.operators.comparison
Groups: php.notes 
Request: Send a blank email to php-notes+get-115762@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"; } [/php] return Yes Use === instead. ---- Server IP: 66.163.161.117 Probable Submitter: 203.160.1.48 (proxied: 222.252.48.16) ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/language.operators.comparison.php Edit -- https://master.php.net/note/edit/68782 Del: integrated -- https://master.php.net/note/delete/68782/integrated Del: useless -- https://master.php.net/note/delete/68782/useless Del: bad code -- https://master.php.net/note/delete/68782/bad+code Del: spam -- https://master.php.net/note/delete/68782/spam Del: non-english -- https://master.php.net/note/delete/68782/non-english Del: in docs -- https://master.php.net/note/delete/68782/in+docs Del: other reasons-- https://master.php.net/note/delete/68782 Reject -- https://master.php.net/note/reject/68782 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#115762) next »