Skip to content

Instantly share code, notes, and snippets.

@logsol
Created September 22, 2011 15:01
Show Gist options
  • Save logsol/1234996 to your computer and use it in GitHub Desktop.
Save logsol/1234996 to your computer and use it in GitHub Desktop.
An insane way to reboot a php project
<?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