Heredoc string not working

I copied this example straight out a PHP book I’m currently reading. I’ve also looked at php.net to verify the syntax but could not see any differences. I use Aptana Studio 3, PHP 5.3.13 through WAMP , and I tested it in both Chrome and Firefox on Windows 7.


<?php
$tobeornottobe = <<<_EOT
To be, or not to be, that is the question:
Whether 'tis Nobler in the mind to suffer
The Slings and Arrows of outrageous Fortune,
Or to take Arms against a Sea of troubles,
And by opposing end them: to die, to sleep
_EOT;

echo $tobeornottobe;
?>

Aptana seems to think that 'tis is the beginning of the string because of the single quotation mark. It also marks the line that ?> is on as a syntax error. Any thoughts?

Thanks!

Try putting an extra space before the herdoc terminator and see if that works?


<?php
$tobeornottobe = <<<_EOT
To be, or not to be, that is the question:
Whether 'tis Nobler in the mind to suffer
The Slings and Arrows of outrageous Fortune,
Or to take Arms against a Sea of troubles,
And by opposing end them: to die, to sleep

_EOT;

echo $tobeornottobe;
?>

Make sure there’s no whitespace at the end of <<<_EOT. The identifier must be followed immediately by a newline.