Created
September 3, 2010 21:26
-
-
Save ah01/564598 to your computer and use it in GitHub Desktop.
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 | |
// 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"; | |
} | |
} |
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
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