wallacemaxters

Untitled

Apr 28th, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.54 KB | None | 0 0
  1. class Container{
  2.  
  3.         private $_test = array();
  4.        
  5.         public function test($test)
  6.         {
  7.             $closure = function($arg){
  8.                 return $this->_test['by_closure'] = $arg;
  9.             };
  10.            
  11.            
  12.             print_r($closure);
  13.            
  14.             return $closure($test);
  15.         }
  16.    }
  17.    
  18.    
  19.    $container = new Container;
  20.    
  21.    $container->test(111);
  22.  
  23. //Closure Object ( [this] => Container Object ( [_test:Container:private] => Array ( ) ) [parameter] => Array ( [$arg] => ) )
Advertisement
Add Comment
Please, Sign In to add comment