Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class standardClass extends stdClass
- {
- public function __get( $index )
- {
- if( !isset( $this->$index ) || !$this->$index instanceof stdClass )
- {
- $this->$index = new standardClass();
- return $this->$index;
- }
- else
- {
- return $this->$index;
- }
- }
- }
- $x = new standardClass();
- $x->y->z = 123;
- print_r( $x );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement