addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1linklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruserwarningyahoo

Re: [php-49] Using colon instead of curly-braces { } with conditionals

From: Andrew
Sent on: Thursday, March 19, 2009 6:03 PM
I prefer using braces. My editor show me the matching braces. My
editor also supports folding entire blocks of code based on braces.
Using a different control structure might also help.  For example,
using 'switch' instead of a if/elseif/else chain can add clarity.  So
I never needed to use the alternate syntax, except to be consistent
with other peoples code.

// Andrew Woods / Web Developer / http://mastodonla...­




On Thu, Mar 19, 2009 at 5:43 PM, David Malouf <[address removed]> wrote:
> Came across this blog entry and it got me wondering...
> http://www.codedi...­
>
> The premise of the article is that when code gets big and nested, using
> curly-braces can get troublesome.�� Instead, PHP can handle a colon followed
> by an END__
>
> For example:
> ������ if ($something == 'true') :
> �������������� $aBunchOfCodeHere = 'yes';
> ������ endif;
>
> Using NetBeans (like Eclipse and I'm assuming other IDEs) means I can 'see'
> what conditional/line each closing-curly-brace�­� }���� is associated with.
>
> Since I'm curious, though, I'm wondering if there is ever a time when any of
> y'all use the colon method?
>
>
> David
>
>
>
>
>
> --
> Please Note: If you hit "REPLY", your message will be sent to everyone on
> this mailing list ([address removed])
> This message was sent by David Malouf ([address removed]) from The Seattle
> PHP Meetup Group.
> To learn more about David Malouf, visit his/her member profile
> To unsubscribe or to update your mailing list settings, click here
>
> Meetup Support: [address removed]
> 632 Broadway, New York, NY 10012 USA

Our Sponsors

  • PluralSight

    PluralSight subscriptions for developer training

  • O'Reilly

    Disc Code: PCBW is good for 40% off print and 50% off ebooks and videos

  • JetBrains PhpStorm

    Occasional free licenses to raffle off at meetups

  • DynaTrace

    Find yourself, promote yourself, stay true to yourself.

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy