PHP heredoc Problems
Except for the echo line, that is from the example on the PHP.net website. I do not want to have to add escape characters to all my stuff and would like to know why I get the error:
Parse error: parse error in /Library/WebServer/Documents/TMPhy0f8o14id.php on line 4
Is there something I have to change in the php.ini file or why-o-why doesn't this work?
<?php
$str = <<<EOD
Example of string
spanning multiple lines
using heredoc syntax.
EOD;
echo($str);
?>
Parse error: parse error in /Library/WebServer/Documents/TMPhy0f8o14id.php on line 4
Is there something I have to change in the php.ini file or why-o-why doesn't this work?
Code:
<?php
$str = <<<EOD
Example of string
spanning multiple lines
using heredoc syntax.
EOD;
echo($str);
?>
Comments
Are you using a text editor to create the file? You have to make sure that there are valid CrLf line ends in the file. If you're not using a text editor I bet that its not putting the proper line ends in.
I used VI to create the php file.
It's very annoying.
Edit: Ok seems to be dreamweaver. I saved two exact files (other then the filename) from dreamweaver and subethaedit and subethaedit worked.