Created
September 22, 2011 15:01
-
-
Save logsol/1234996 to your computer and use it in GitHub Desktop.
An insane way to reboot a php project
This file contains 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 | |
while(true) | |
{ | |
try | |
{ | |
$bootstrap = new Bootstrap(); | |
$bootstrap->run(); | |
} | |
catch(Restarter $restarter) | |
{ | |
continue; | |
} | |
break; | |
} | |
class Bootstrap() | |
{ | |
public function run() | |
{ | |
// this can be somewhere deep in my program | |
if($myCondition) | |
{ | |
throw new Restarter(); | |
} | |
} | |
} | |
class Restarter extends Exception {} | |
// well i guess this is probably pretty vulnerable to infinite loops, but i still like the idea :D |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment