Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $add_to = new stdClass();
- $add_to->y = 0;
- $add_to->add = function( $x ) use( $add_to ){ return $x + $add_to->y; };
- $add_to->y = 10;
- $add = $add_to->add;
- echo $add( 5 ) . '<br>';
Advertisement
Add Comment
Please, Sign In to add comment