News Feed
Sections




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

Arnold Daniels' Blog:
Perl like temporary variables in PHP
November 02, 2007 @ 09:38:00

Arnold Daniels points out a quick method for creating what he calls "perl-like temporary variables" in the global scope of a script:

When writing code in the global scope, I often have a problem where I'm overwriting a variable. This happens even more often when I work on code of somebody else. Usually has the variable which does the overwriting is usually just a temporary variable.

His code is a simple few lines that shows how it could be used when trying to write information out to a file handle. Some of the comments on the post criticize his use of the global scope but Arnold comes back with his reasoning - mostly that there is already code in the global scope and that adding something else is only adding to it, not making things worse.

0 comments voice your opinion now!
temporary variable perl global scope temporary variable perl global scope


blog comments powered by Disqus

Similar Posts

Hasin Hayder's Blog: Did you know 'you can have cheese burger' could be a variable name?

Jacob Santos' Blog: Global Functions and How to Not Use Them

Tnx.nl: PHP in Contrast to Perl

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

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


Community Events

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


language wordpress series library laravel introduction list api community voicesoftheelephpant release laravel5 interview extension framework opinion php7 version unittest podcast

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