200-710 Exam QuestionsBrowse all questions from this exam

200-710 Exam - Question 3


What is the output of the following code?

Show Answer
Correct Answer: A,B

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

1 comment
Sign in to comment
buiphucOption: A
Nov 22, 2023

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