Advertisement
darkmavis1980

extract

Feb 24th, 2015
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.25 KB | None | 0 0
  1. <?php
  2. class MyClass{
  3.     public function MyMethod(array $options = array()){    
  4.         extract($options);     
  5.     }
  6. }
  7.  
  8. $my = new MyClass();
  9. $my->MyMethod(array('name' => 'john', 'surname' => 'doe'));
  10. //Now MyMethod has two internal vars called $name and $surname
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement