> -----Original Message-----
> From: Jay Blanchard [mailto:[EMAIL PROTECTED]
> Sent: Friday, June 27, 2008 8:50 AM
> To: tedd; php-general@lists.php.net
> Subject: RE: [PHP] Re: Inspiration for a Tombstone.
> 
> [snip]
> And being dyslexic, I knew the 'Dan S' should have come first, but
> didn't immediately recognize it as I was rushing to point out a
> double equal-sign boo-boo made by Col.
> [/snip]
> 
> Had Col used the method we're speaking of here the error would have
> been
> thrown and he would have found the culprit post haste.
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

I think you guys are missing something: he wrote it with single equals
signs on purpose. He was demonstrating how the one with the constant to
the right of the assignment operator is a valid statement... and that
putting the constant first will aid you in finding such mistakes.

if("constant" = $variable){} // bombs, and lets you know right away you
missed an =
if($variable = "constant"){} // assigns rather than compares, but
nonetheless is valid code

To quote Colin: "As I very humorously hinted at in a earlier mail on
this thread, it is a very, very good idea to get into the habit of
putting constants *first* in if/while/etc statements." So, I'm sure he
is well familiar with this "method we're speaking of." :)


Todd Boyd
Web Programmer




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to