RalfAlbert

schoenfinkeln

Aug 18th, 2012
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.19 KB | None | 0 0
  1. <?php
  2. $add_to = new stdClass();
  3. $add_to->y = 0;
  4. $add_to->add = function( $x ) use( $add_to ){   return $x + $add_to->y; };
  5.  
  6.  
  7. $add_to->y = 10;
  8. $add = $add_to->add;
  9.  
  10. echo $add( 5 ) . '<br>';
Advertisement
Add Comment
Please, Sign In to add comment