Created
May 30, 2014 20:22
-
-
Save shadda/60559ffa8cdeab7ca447 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $foo = new stdClass; | |
| $foo->bar = 1; | |
| try | |
| { | |
| $f = function() use($foo) | |
| { | |
| var_dump($foo); //should be 1 | |
| $foo->bar++; | |
| var_dump($foo); //should be 2 | |
| $foo->bar++; | |
| throw new Exception("boogers"); | |
| $foo->bar = 20; // will never get run | |
| }; | |
| $f(); | |
| } | |
| catch(Exception $e) | |
| { | |
| var_dump('error', $foo); //should be 3 | |
| } | |
| var_dump($foo->bar); //should be 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment