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:
Overloading arrays in PHP 5.2.0
January 19, 2008 @ 08:01:25

In a new post to his blog, Matthew Weir O'Phinney talks about a method for overloading arrays in a script written for the PHP 5.2 series.

Several weeks back, a bug was reported against Zend_View that had me initially stumped. [...] I'd read about this some months back on the php internals list, but at the time hadn't understood the consequences.

Basically, __get() no longer returns a reference and returns values in read mode, which makes modifying arrays using overloading impossible using traditional methods.

Unfortunately, this was exactly the functionality that was needed, so Matthew set out to find a way to do just that. His initial method, extending the ArrayObject, worked but still gave errors. On Mike Naberezny's recommendation, though, this too was resolved with a simple call to the __set method instead.

0 comments voice your opinion now!
overload array arrayobject set get reference overload array arrayobject set get reference


blog comments powered by Disqus

Similar Posts

DevShed: Abstract Classes in PHP - Setting Up a Concrete Example

Community News: Too Many Frameworks? (Andrei Zmievski and Clay Loveless)

Nikic's Blog: How big are PHP arrays (and values) really? (Hint: BIG!)

Derick Rethans' Blog: Circular References

Matthew Weir O'Phinney's Blog: The light has not set on PHP


Community Events





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


api zendserver series tips introduction community list framework update language library opinion package release interview podcast deployment symfony install laravel

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