Control Structures
May 9th, 2008 | by Avatar |There used to be an old saying in PHP that a control structure needs a single constant to locate it and a set of brackets to clear it all up. Well, that might all be true but using too many of these curly brackets when it isn’t needed at all doesn’t help you any and it even makes your code a tad bit harder to understand. Let’s show this with the following example:
if ($superman == ‘alien’) {
$strength — ;
}
Saying that, it would be simpler to code it in this simpler more readable manner:
if ($superman == ‘alien’) $strength — ;
The fewer brackets that muddle up the code the better for it makes it all the readable thus easier to understand and fix in case something goes wrong.

Sorry, comments for this entry are closed at this time.