I'm just wondering if I were to release some PHP program for others to use and mod if this would be a better way to format my code -- I'll give you all an example of how I've decided to format an if command.
Placing each boolean on only one line, creating a line break before and after ( and ) if there hasn't been one created already, and one after any operators such as &&, and, or, ||, xor, etc...
So, for example, is this new style:
[PHP]if(
(
blah &&
blah &&
(
blah ||
(
blah &&
blah
)
) ||
(
(
blah &&
blah &&
(
blah ||
blah
)
) &&
(
blah ||
blah
)
)
)
)[/PHP]
Better than...
[PHP]if((blah && blah && (blah || (blah && blah)) || ((blah && blah && (blah || blah)) && (blah || blah))))[/PHP]
By the way, I know that variables have $ in front of them.
Just wanted some input from other various [probably more experienced] PHP coders that [obviously] use the if command quite frequently. :P
If someone has a better example they could show me, please do so. :)
Placing each boolean on only one line, creating a line break before and after ( and ) if there hasn't been one created already, and one after any operators such as &&, and, or, ||, xor, etc...
So, for example, is this new style:
[PHP]if(
(
blah &&
blah &&
(
blah ||
(
blah &&
blah
)
) ||
(
(
blah &&
blah &&
(
blah ||
blah
)
) &&
(
blah ||
blah
)
)
)
)[/PHP]
Better than...
[PHP]if((blah && blah && (blah || (blah && blah)) || ((blah && blah && (blah || blah)) && (blah || blah))))[/PHP]
By the way, I know that variables have $ in front of them.
Just wanted some input from other various [probably more experienced] PHP coders that [obviously] use the if command quite frequently. :P
If someone has a better example they could show me, please do so. :)
Comment