daily pastebin goal
51%
SHARE
TWEET

stdClass

a guest May 17th, 2011 176 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class standardClass extends stdClass
  2. {
  3.  
  4.         public function __get( $index )
  5.         {
  6.        
  7.                 if( !isset( $this->$index ) || !$this->$index instanceof stdClass )
  8.                 {
  9.                         $this->$index = new standardClass();
  10.                         return $this->$index;
  11.                 }
  12.                 else
  13.                 {
  14.                         return $this->$index;
  15.                 }
  16.                
  17.         }
  18.        
  19. }
  20.  
  21. $x = new standardClass();
  22. $x->y->z = 123;
  23. print_r( $x );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top