News Feed
Jobs Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Ask About PHP:
PHP's alternative syntax and why it's useful
April 16, 2009 @ 07:50:56

On the "Ask About PHP" blog today there's a new post looking at some of the alternative syntaxes that PHP has to offer for control structures.

PHP offers an alternative way to write their control structures for as long as I've remembered. It basically does away with the curly brackets and replaces the opening curly with a colon (:) and the closing with '˜end'-whatever. I have to be honest and say I've never really found a need to use the alternative syntax, simply because I'm so used to using the curly braces after so many years of using PHP. Plus, it's less typing!

The one specifically mentioned deals with "if" evaluations. There's two other options to the usual braces method - one being a shorthand using colons and a semicolon and the other using the ternary syntax.

0 comments voice your opinion now!
alternative syntax control structure if example colon ternary


blog comments powered by Disqus

Similar Posts

Expirmentalworks.net: Inofficial PHP GIT repositories - Importing large trees

Mikko Koppanen's Blog: ImagickPixelIterator is not read-only after all...

PHP-GTK Community Site: Using GtkSourceview to build a php editor with syntax highlighting

Justin Silverton\'s Blog: How to Cache Smarty Templates (as per the manual)

PHPit.net: Having fun with PHP\'s output buffer


Community Events











Don't see your event here?
Let us know!


facebook release language hack component hhvm security database symfony2 package application composer framework overview introduction unittest podcast opinion install performance

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework