News Feed
Sections




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

Leonid Mamchenkov's Blog:
Perl vs. PHP variable scoping
December 12, 2008 @ 08:49:14

Leonid Mamchenkov has compared Perl versus PHP in this new blog post - specifically how they handle variable scoping.

I've mentioned quite a few times that I am a big fan of Perl programming language. However, most of my programming time these days is spent in PHP. The languages are often similar, with PHP having its roots in Perl, and Perl being such a influence in the world of programming languages. This similarity is often very helpful. However there are a few difference, some of which are obvious and others are not.

His example compares looping (a foreach in both) and how, after the Perl loop the $value variable is no longer accessible. In PHP, however, it's passed back out into the current scope and can be read just like any other variable. While this can be useful, it can also cause headaches when trying to track down elusive bugs.

1 comment voice your opinion now!
variable scope foreach loop local outside compare


blog comments powered by Disqus

Similar Posts

John Mertic's Blog: PHP Windows Installer updated for PHP 5.2.0RC2 and more

Joakim Nygard's Blog: Optimizing PHP Through Habits

Tom Barrett's Blog: WordPress is more than a CMS, it is a PHP Framework

David Coallier's Blog: PHP's Strong typing (SPL_Types) and a bit of ranting about winter...

PHPBuilder.com: Object-Oriented Features New To PHP5


Community Events





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


laravel developer configure podcast threedevsandamaybe install api release list code wordpress bugfix library series unittest interview application introduction community language

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