getMessage(), "\n"; } finally { e">
MCQs > IT & Programming > PHP 5 > What will be the output of the following PHP 7.1 code? function inverse($a){ if (!$a){ throw new Exception( } return 20/$a; } try { echo inverse(8).

PHP 5 MCQs

What will be the output of the following PHP 7.1 code?

function inverse($a){

if (!$a){

throw new Exception( }

return 20/$a;

}

try {

echo inverse(8). "\n";

} catch (Exception $ex) {

echo 'Exception caught: ', $ex->getMessage(), "\n";

} finally {

echo "First Example.\n";

}

try {

echo inverse(0). "\n";

} catch (Exception $ex) {

echo 'Exception Caught: ', $ex->getMessage(), "\n";

} finally {

echo "Second Example.\n";

}

echo "Learning PHP\n";

?>

Answer

Correct Answer:

2.5

First Example.

Exception Caught:Division by zero is not allowed.

Second Example.

Learning PHP


Explanation:

Note: This Question is unanswered, help us to find answer for this one

PHP 5 Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

PHP 5 Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it