Skip to content

Instantly share code, notes, and snippets.

@Intrepidity
Created July 19, 2016 13:58
Show Gist options
  • Save Intrepidity/5ba649520f85b7f2758e44a9839f317b to your computer and use it in GitHub Desktop.
Save Intrepidity/5ba649520f85b7f2758e44a9839f317b to your computer and use it in GitHub Desktop.
<?php
function random_exception()
{
foreach(get_declared_classes() as $class) {
$exceptions = [];
if (substr($class, -9) === 'Exception') {
$exceptions[] = $class;
}
$exception = $exceptions[array_rand($exceptions)];
throw new $exception();
}
}
random_exception();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment