News Feed
Sections




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

Mike Wallner's Blog:
__get() and array rumors
August 21, 2006 @ 07:49:03

In a brief new post, Mike Wallner talks about some of the discussion surrounding overloaded array properties lately and something he's discovered about it.

As arrays are the only complex types that are passed by value (resources don't really count here) the solution to described problem is simple: use an object; either an instance of stdClass or ArrayObject will do well, depending if you want to use array index notation.

He includes two code examples, one just trying to overload it in a class with __get (yielding an error) and the other using the constructor to pass an ArrayObject out first, allowing for error-free assignment.

0 comments voice your opinion now!
arrayobject overload array properties get construct arrayobject overload array properties get construct


blog comments powered by Disqus

Similar Posts

Matthew Weir O'Phinney's Blog: Zend_Form Advanced Features

Michael Kimsal's Blog: Grails for PHP Developers Part 5

DZone.com: PHP 5.4 features poll: the results

Maarten Balliauw's Blog: PHPLinq 0.4.0 released on CodePlex!

DevShed: Fetching Search Results as Serialized Arrays with Yahoo Web Services and PHP 5


Community Events

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


release part2 example symfony2 community laravel api interview configure php7 opinion series introduction application conference podcast framework performance language voicesoftheelephpant

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