News Feed
Sections




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

PHP-Coding-Practices.com:
Composing Methods Split Temporary Variable
July 04, 2007 @ 11:26:00

On the PHP-Coding-Practices.com blog, there's a tutorial posted from Tim Koschuetzki in his "Composing Methods" series looking at assigning temporary variables.

When you have the same temporary variable assigned to more than once, split it up into two, unless it is a loop variable. [...] Temporary variables have various uses. They can be used as counters in loops, as collecting variables building up a result or as simple containers containing the result of a long-winded expression for easy reference.

He offers suggestions of using temporary variables, including changing references of it after use and making a new temp variable following the second assignment of the first one. Some sample code is included to illustrate the points made.

0 comments voice your opinion now!
temporary variable compose method tutorial temporary variable compose method tutorial


blog comments powered by Disqus

Similar Posts

SitePoint PHP Blog: How to Use PHP Namespaces, Part 1: The Basics

Devshed: Simple and Secure PHP Login Script

Mike Willbanks' Blog: Getting Started with Nginx and PHP-FPM

Tony Lukasavage's Blog: PHP Debugging on IntelliJ IDEA 10 with Xdebug

DZone.com: Video: PHP 5.3.1, MongoDB and Lithium on Windows 7 / IIS 7


Community Events





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


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

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