note 81698 added to control-structures.if
| From: | grawity at gmail dot com | Date: | Mon, 10 Mar 2008 11:41:06 +0000 |
| Subject: | note 81698 added to control-structures.if | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-136895@lists.php.net to get a copy of this message | ||
re: #80305
Again useful for newbies:
if you need to compare a variable with a value, instead of doing
<?php
if ($foo == 3) bar();
?>
do
<?php
if (3 == $foo) bar();
?>
this way, if you forget a =, it will become
<?php
if (3 = $foo) bar();
?>
and PHP will report an error.
----
Server IP: 193.219.81.76
Probable Submitter: 78.56.68.25
----
Manual Page -- http://www.php.net/manual/en/control-structures.if.php
Edit -- https://master.php.net/note/edit/81698
Del: integrated -- https://master.php.net/note/delete/81698/integrated
Del: useless -- https://master.php.net/note/delete/81698/useless
Del: bad code -- https://master.php.net/note/delete/81698/bad+code
Del: spam -- https://master.php.net/note/delete/81698/spam
Del: non-english -- https://master.php.net/note/delete/81698/non-english
Del: in docs -- https://master.php.net/note/delete/81698/in+docs
Del: other reasons-- https://master.php.net/note/delete/81698
Reject -- https://master.php.net/note/reject/81698
Search -- https://master.php.net/manage/user-notes.php