Exam 200-710 All QuestionsBrowse all questions from this exam
Question 3

What is the output of the following code?

    Correct Answer: A

    The output of the code is 'This is text'. This is because the code uses a 'heredoc' syntax in PHP, which allows the definition of multiline strings. The line $text1 = <<<‘TEXT’ $text TEXT; assigns the value of the variable $text (which is 'This is text') to $text1. Then, $text2 = <<<TEXT $text1 TEXT; assigns the value of $text1 to $text2. Finally, echo $text2; outputs 'This is text'.

Discussion
buiphucOption: A

Correct answer is A <?php // Enter your code here, enjoy! $text ='this is text'; $text1 = <<<TEXT $text TEXT; $text2 = <<<TEXT $text1 TEXT; echo $text2; Output : this is text