Re: Re: Inspiration for a Tombstone.

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

 



On Fri, Jun 27, 2008 at 6:01 AM, Colin Guthrie <gmane@xxxxxxxxxxxxxx> wrote:
> 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.

    You raise a very good and valid point, Col.  I format my code that
way with C/C++, BASH, even Tcl/Tk (yeah, I said it), but for some
reason I never remember to do it in PHP.  I think it's time to start
forcing myself to develop that habit.

-- 
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
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