Re: Inspiration for a Tombstone.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dan Shirah wrote:
if ($user_name == "Dan S") {
  echo "Quit while you're ahead";
}
exit;

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.

if ("Dan S" = $user_name)

PHP/C/C++ etc. Bombs with a syntax error.


if ($user_name = "Dan S")

Works silently and looks right at first glance.


I forced myself to write things that way round a good number of years ago and it has served me well and caught a few potential mishaps.

Col.





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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux