News Feed
Sections




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

Matthew Weir O'Phinney's Blog:
PHP globals for the OOP developer
May 25, 2007 @ 10:35:00

Matthew Weir O'Phinney has two new posts that talk about something object-oriented developers seem to shy away from - globals in their classes and how they can make things more difficult to make "embeddable applications" a reality.

In my previous entry, I ranted about the use of globals in popular PHP applications, and how they make embedding said applications difficult. I develop using object-oriented practices, and can honestly say I can't recall ever having slung a global variable around in my own code. Globals seem hackish to me, and as a result, trying to get applications that use them to behave correctly has been a challenge.

In the first part, he notes an interesting find about the $GLOBALS value and illustrates with a code example how he was able to get around it in his instance (wrapping a Serendipity instance in a Zend Framework app).

In part two, though, and uses another code example to show what kind of issues he was seeing with the $GLOBALS - a script that sets some globals in different instances and echoes the results back out.

0 comments voice your opinion now!
globals objectoriented developer example globals objectoriented developer example


blog comments powered by Disqus

Similar Posts

Job Posting: Digicraft Productions Seeks Web Designer/Developer (Orlando, FL)

StackExchange.com: What features would you like to have in PHP?

Job Posting: Veedow Seeks LAMP Developer (London, UK)

Kevin Schroeder's Blog: Tapping millions of non-PHP PHP developers (manager's guide for Java to PHP)

Matthew Weir O'Phinney's Blog: PHP 5's Reflection API


Community Events





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


composer release series language community list introduction version symfony voicesoftheelephpant artisanfiles security tool framework podcast library interview conference opinion laravel

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