[thelist] Alternative Control Structure Syntax in PHP

Chris Dorer cdorer at gmail.com
Tue Aug 29 13:04:52 CDT 2006


It's a subjective matter really.  Most developers minds are tuned to seeing
the brackets more than anything else and can collectively find the block of
code defined within brackets.

To me, it's more confusing to read that because it'll take longer for me to
find the end of the if statement because I want to look for an ending
bracket, not a word, by instinct.

The only place i don't use a standard if statement is if it's a single line
( bool ? block1 : block2 ).

And I also agree with Sarah, it takes less typing using brackets.

On 8/29/06, Sarah Adams <mrsanders at designshift.com> wrote:
>
> > <?php if ($a == 5): ?>
> > A is equal to 5
> > <?php endif; ?>
>
> > I personally like it in cases as above where the block extends beyond
> > the ending ?> tag.
>
> Personally, I would think this syntax is just as easy to read/type, but
> maybe I'm missing something:
>
> <?php if ($a == 5) { ?>
> A is equal to 5
> <?php } ?>
>
> --
> sarah adams
> web developer & programmer
> portfolio: http://sarah.designshift.com
> blog: http://hardedge.ca
> --
>
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>



More information about the thelist mailing list