I have a situation where it would be nice to be able to have a catch block where the type of the Exception is determined at run time. It would work something like this:
That doesn't work as far as I'm aware. You could mimic that functionality with a control statement like this:
$someClass = 'SomeException';
try
{
$some->thing();
}
catch (Exception $e)
{
switch (get_class($e))
{
case $someClass:
echo 'Dynamic exception.';
break;
default:
echo 'Normal exception.';
}
}