Handling exception in PHP

Predict the output of the following code snippet.

<?php

function sample() {

try {

throw new Exception(‘Hello World’);

} catch (Exception $e) {

return ‘catch’;

} finally {

return ‘finally’;

}

}

echo sample();

?>

Options
  1. Hello World
  2. catch
  3. finally
  4. None of these

Related Posts

Close Bitnami banner
Bitnami