Consider:
try{
class MyException extends Exception{}
try{
throw new MyException;
}
catch(Exception $e){
echo "1:";
throw $e;
}
catch(MyException $e){
echo "2:";
throw $e;
}
}
catch(Exception $e){
echo get_class($e);
}
I am confused with this try and catch. I am expecting a 2:MyException
result because of the second try throw MyException
. But the actual result is 1:MyException
. What is the explanation?