Edit report at http://bugs.php.net/bug.php?id=37882&edit=1
ID: 37882 Updated by: johan...@php.net Reported by: php at bouchery dot com Summary: overloading array access -Status: Open +Status: Closed Type: Feature/Change Request -Package: Feature/Change Request +Package: *General Issues Operating System: all PHP Version: 5.1.5CVS -Assigned To: +Assigned To: johannes Block user comment: N Private report: N New Comment: The ArrayAccess interface exists meanwhile for this purpose. Previous Comments: ------------------------------------------------------------------------ [2008-04-09 07:56:43] ois at oisnot dot com AS has been specified in comments here: http://no2.php.net/manual/en/language.oop5.overloading.php I think this should be set with the __set overload not __get though. ------------------------------------------------------------------------ [2006-06-22 07:39:23] php at bouchery dot com Description: ------------ I would like to overload array access like this <?php class MyClass { private $parameters = array(); function __set( $name, $value, $key ) { if( ! isset( $this->parameters[ $name ] ) ) { $this->parameters[ $name ] = array(); } $this->parameters[ $name ][ $key ] = $value; } } $object = new MyClass; $object->a[ 'x' ] = 'value'; ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=37882&edit=1