MCQs > IT & Programming > PHP > What is the output? getMessage(), '\n'; } finally { echo 'first\n'; } try { echo myFun(1) . '\n'; } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), '\n'; } finally { echo 'second\n'; } echo 'Hello PHP Example\n'; ?>

PHP MCQs

What is the output when the following code is executed? <?php function myFun($a) { if (!$a) { throw new Exception('Value init.'); } return 3/$a; } try { echo myFun(3) . "\n"; } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; } finally { echo "first\n"; } try { echo myFun(1) . "\n"; } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; } finally { echo "second\n"; } echo "Hello PHP Example\n"; ?>

Answer

Correct Answer: 1 first 3 second Hello PHP Example

Explanation:

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

PHP Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

PHP Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it