View Single Post
Old 06-10-2009, 05:42 PM   #4 (permalink)
Village Idiot
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

One thing I've began to do that most do not is placing the constant to the left and the variable to the right. For example
PHP Code:
if(1==$variable)
{
//do this

This makes it harder to accidentally forget the second = and assign the variable. Since I program in VB as a profession (one = check in an IF statement) and do PHP and C on the side, it is very easy to accidentally put one = instead of two. With this approach, the program will generate a parse error because you are trying to assign a constant.

It looks awkward at first but becomes very useful once you get used to it.
__________________

Village Idiot is offline  
Reply With Quote