PHP MCQ PHP Basic MCQ Question #2367
MCQ Single Best Answer Not Set

QWhat will be the output of the following PHP code?
< ?php 
    $num = 10;
    echo 'What is her age? \n She is $num years old';
?>

ID: #2367 PHP Basic MCQ 1,789 views
Question Info
#2367Q ID
Not SetDifficulty
PHP Basic MCQTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A What is her age? \n She is $num years old
  • B What is her age? She is $num years old
  • C What is her age? She is 10 years old
  • D What is her age? She is 10 years old
Correct Answer: Option A

Explanation

When a string is enclosed within single quotes both variables and escape sequences will not be interpreted when the string is parsed.

Share This Question

Challenge a friend or share with your study group.