Created
March 17, 2012 07:48
-
-
Save sasezaki/2056314 to your computer and use it in GitHub Desktop.
php retry by limited goto
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 | |
| static $retry = 0; | |
| retry: | |
| try { | |
| echo time(), PHP_EOL; | |
| throw new \RuntimeException; | |
| } catch (RuntimeException $e) { | |
| if (++$retry < 3) goto retry; | |
| } | |
| echo 'done'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment