note 87775 added to language.operators.comparison
| From: | mruivo at gmail dot com | Date: | Sun, 21 Dec 2008 03:13:01 +0000 |
| Subject: | note 87775 added to language.operators.comparison | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-148401@lists.php.net to get a copy of this message | ||
Note that an expression where a boolean variable and a string are compared with the equal operator,
will always come out true as a string is technically true. For example:
<?php
$variable = true;
if ($variable == "something") {
//This code will be excecuted
}
?>
To get around this use the identical operator ===, as the types are not the same.
----
Server IP: 216.235.15.211
Probable Submitter: 99.226.69.163
----
Manual Page -- http://www.php.net/manual/en/language.operators.comparison.php
Edit -- https://master.php.net/note/edit/87775
Del: integrated -- https://master.php.net/note/delete/87775/integrated
Del: useless -- https://master.php.net/note/delete/87775/useless
Del: bad code -- https://master.php.net/note/delete/87775/bad+code
Del: spam -- https://master.php.net/note/delete/87775/spam
Del: non-english -- https://master.php.net/note/delete/87775/non-english
Del: in docs -- https://master.php.net/note/delete/87775/in+docs
Del: other reasons-- https://master.php.net/note/delete/87775
Reject -- https://master.php.net/note/reject/87775
Search -- https://master.php.net/manage/user-notes.php