Guest User

Untitled

a guest
Jun 24th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.54 KB | None | 0 0
  1.     class PostHandler{
  2.         private $data;
  3.         private $current;
  4.        
  5.         public function __set($key, $value){
  6.             $this->data[$key] = $value;
  7.         }
  8.        
  9.         public function __get($key){
  10.             $this->current = $this->data[$key];
  11.             return $this;
  12.         }
  13.        
  14.         public function submit(){
  15.             echo 'Posting message: ' . $this->current;
  16.         }
  17.     }
  18.    
  19.     $postHandler = new PostHandler();
  20.     $postHandler->vincent = 'vincent';
  21.     $postHandler->vincent->submit();
Add Comment
Please, Sign In to add comment