Skip to content

Instantly share code, notes, and snippets.

@ah01
Created September 3, 2010 21:26
Show Gist options
  • Save ah01/564598 to your computer and use it in GitHub Desktop.
Save ah01/564598 to your computer and use it in GitHub Desktop.
<?php
// Print all Exception classes in PHP
foreach (get_declared_classes() as $class)
{
if(is_subclass_of($class, "Exception"))
{
echo $class . "\n";
echo "\tparent: " . get_parent_class($class) . "\n";
}
}
Typical result on PHP 5.2
ErrorException
parent: Exception
ReflectionException
parent: Exception
LogicException
parent: Exception
BadFunctionCallException
parent: LogicException
BadMethodCallException
parent: BadFunctionCallException
DomainException
parent: LogicException
InvalidArgumentException
parent: LogicException
LengthException
parent: LogicException
OutOfRangeException
parent: LogicException
RuntimeException
parent: Exception
OutOfBoundsException
parent: RuntimeException
OverflowException
parent: RuntimeException
RangeException
parent: RuntimeException
UnderflowException
parent: RuntimeException
UnexpectedValueException
parent: RuntimeException
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment