I'm testing the following code. I'm using PHP heredoc but I'm getting an error from dreamweaver. If I write it manually, it works. If I copy paste it doesn't work. Why is that?
<?php
$e=<<<EOP
whoever
EOP;
$el=<<<EOG
whatever
EOG;
?>
I'm testing the following code. I'm using PHP heredoc but I'm getting an error from dreamweaver. If I write it manually, it works. If I copy paste it doesn't work. Why is that?
<?php
$e=<<<EOP
whoever
EOP;
$el=<<<EOG
whatever
EOG;
?>
There is a space after your last closing identifier.
<?php
$e=<<<EOP
whoever
EOP;
$el=<<<EOG
whatever
EOG;
^ right there
?>
As per documentation http://php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
Warning It is very important to note that the line with the closing identifier must contain no other characters, except a semicolon (;). That means especially that the identifier may not be indented, and there may not be any spaces or tabs before or after the semicolon. It's also important to realize that the first character before the closing identifier must be a newline as defined by the local operating system. This is \n on UNIX systems, including Mac OS X. The closing delimiter must also be followed by a newline.
try to remove a space after "EOG;"
<?php
$el=<<<EOG
whatever
EOG;
?>