News Feed
Sections




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

Alex Netkachov's Blog:
6 PHP coding tips to write less code
November 05, 2007 @ 07:58:00

Alex Netkachov has shared six tips in a new post on his blog today for how you can write less PHP code and get more done with it. It's based around another post from Arnold Daniels talking about a temporary variable method in PHP.

This tip is useful to "lazy" developers who do not even think about variable names. They may prefer magic names like ${0} and 0 is good enough variable name, why not...

His list consists of:

  • Use || (or) and && (and) operations instead of if.
  • Use ternary operator.
  • Use for instead of while.
  • In some cases PHP requires you to create a variable. [...] To handle all these situation you can create a set of small functions which shortcuts frequently used operations.
  • Explore the language you use.
  • When it is better to write more and then read the code easily, do not be lazy.

Check out Vidyut Luther's response to Alex's comments as well as one from Richard Heyes.

0 comments voice your opinion now!
lazy tips less list temporary variable arnolddaniels lazy tips less list temporary variable arnolddaniels


blog comments powered by Disqus

Similar Posts

PHPMaster.com: Speeding Up Your CakePHP Websites

Matthew Turland's Blog: Zend Framework and Remember The Milk

Noupe.com: 20 Useful PHP + jQuery Components & Tuts for Everyday Project

PHP 10.0 Blog: php -T (variable tainting)

Alex Netkachov's Blog: 6 PHP coding tips to write less code


Community Events





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


framework zendserver community voicesoftheelephpant series library bugfix symfony podcast introduction deployment interview unittest package opinion install api laravel release language

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