<?php
function f() {
try {
return 2;
} finally {
throw new Exception("oops!");
echo "this will be called\n";
return 3;
echo "this will not be called\n";
}
//this will never be called
echo "you can not see me";
}
echo f();
Fatal error: Uncaught Exception: oops! in /in/UEHEj:6
Stack trace:
#0 /in/UEHEj(14): f()
#1 {main}
thrown in /in/UEHEj on line 6
Process exited with code 255.
Output for 5.5.24 - 5.5.35, 5.6.7 - 5.6.28
Fatal error: Uncaught exception 'Exception' with message 'oops!' in /in/UEHEj:6
Stack trace:
#0 /in/UEHEj(14): f()
#1 {main}
thrown in /in/UEHEj on line 6
Process exited with code 255.
Output for 5.4.0 - 5.4.45
Parse error: syntax error, unexpected 'finally' (T_STRING), expecting catch (T_CATCH) in /in/UEHEj on line 5
Process exited with code 255.