[wp-hackers] Coding style (if : endif vs if {})
Matt Mullenweg
m at mullenweg.com
Sat Jul 10 17:31:58 UTC 2004
Rich Bowen wrote:
> First, the disclaimer: I DO NOT want to create an issue where there is
> none. I don't want to start a holy war. I have personal preferences, but
> intend to adhere to whatever the local convention is. I'm much more
> intested in making my patches easy to apply than in espousing a
> particular style.
I've found the if : endif; style is much clearer and easier to understand
for people who may not have previous coding experience, and for people
that do have previous coding experience it takes just a second to figure
out what's going on. For very long blocks of code, I think it's handy, but
I'm not about to rewrite every conditional in WP code. However the
user-facing code (like index.php) should be using this where possible. The
main downside to this style is it breaks "brace matching" in the editors I
use, but then again you don't need brace matching as much because things
are clearer. :)
It is a good syntax to keep in mind if you're doing code that people who
aren't PHP savvy will be editing.
--
Matt Mullenweg
http://photomatt.net | http://wordpress.org
http://pingomatic.com | more soon...
More information about the hackers
mailing list