Zend Certified PHP Engineer (ZCE) PHP 5.5 — Question 3

What is the output of this code?
$world = 'world';
echo <<<'TEXT'
hello $world
TEXT;

Answer options

Correct answer: C

Explanation

The correct answer is C, as the heredoc syntax used in this code does not parse variables. Therefore, '$world' is outputted literally instead of being replaced with its value. Options A and B are incorrect because option A suggests variable parsing occurs, and option B suggests the output is the variable name, neither of which is true in this case.