News Feed
Sections




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

Stas Malyshev's Blog:
Shortcuts
August 05, 2011 @ 10:50:34

In a recent post to his blog Stas Malyshev talks about shortcuts - those things that languages include to make your code shorter and your life easier...or do they?

PHP is notorious among scripting languages for it's verbose syntax - you have to spell out many things that are much shorter in other languages. Some people think it's very bad that they can't be "expressive", meaning writing more clever code with less keystrokes. Sometimes they are right, sometimes they are not.

He talks about the upcoming syntax change in PHP 5.4 for defining arrays (being able to use square brackets) and how it makes sense based on the standards of other languages using a similar syntax. He gives one bad example from Python, though - how Python 2 handled the catching of exceptions and assigning the result.

Some people in PHP community think all "shortcuts" are best to be avoided. I think some of them could be useful, provided clarity is not sacrificed and there's not "too much magic".
0 comments voice your opinion now!
shortcuts language opinion array syntax python


blog comments powered by Disqus

Similar Posts

CodeSnipers.com: Perl vs. PHP - Datatypes[arrays|lists|hash|map]

Stefan Koopmanschap's Blog: Your error page can be better

Reddit.com: Preferred framework for REST usage?

Kevin Schroeder's Blog: Call for webinars (Zend)

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


Community Events





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


laravel framework threedevsandamaybe opinion unittest developer release symfony2 testing interview language refactor podcast series list introduction code community api install

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