20th January 2008 - 4 minutes read time
If you have programmed in PHP for any amount of time then you will be farmiliar with the if statement. The syntax is as follows:
if($something == $somethingelse){
//do something
}elseif($something == $anotherthing){
//do another thing
}else{
// default action
}
The PHP engine also allows you to do what I call "lazy programming" where you don't need the curly braces. Only the line underneath the if statement is run if the if clause if met.
if($something == $somethingelse)
// do something
The issue here is that when this is put into the rest of the program the code becomes almost unreadable and therefore unmaintainable. The curly brases make it much easier to see what a program is doing. For readability and maintenance, many developers consider it bad style not to include them.