Re: Testing Variables
| From: | Richard Baskett | Date: | Thu, 02 Oct 2003 03:31:58 +0000 |
| Subject: | Re: Testing Variables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-164673@lists.php.net to get a copy of this message | ||
on 10/1/03 8:23 PM, Gerard Samuel at gsam@trini0.org wrote:
> I've noticed code written in this order ->
> if (FALSE === $foo)
> {
> // yada yada
> }
>
> Is there a reason/benefit to test variables like that instead of ->
> if ($foo === FALSE)
> {
> // yada yada
> }
>
> Thanks
I think it's more to catch errors.. for example.. if I typed this:
if ($foo = FALSE)
You will not get an error since you are assigning $foo the value of FALSE
while if you did this:
if (FALSE = $foo)
PHP will throw up an error because you can not assign FALSE the value of
$foo :)
That's the only reason that I can think of.
Cheers!
Rick
"You've got to stand for something or you will fall for anything" - Unknown