I\'m fairly new to php and I\'m using a script that creates a function called the \"mime_mailer\" which essentially allows me to use PHP to send emails that are able to be desig
What version of php are you using? The nowdoc syntax is only valid since PHP 5.3.0. See the manual: http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.nowdoc
Just had the same problem.
Turned out to be content on the same line as my opening HERDEOC
wrong example
echo <<<HEREDOC code started on this line
HEREDOC;
correct example
echo <<<HEREDOC
code should have started on this line
HEREDOC;
Hope this helps someone else!
There is a bug in function_mime_mailer.php:
if(empty($headers)){
$headers = "MIME-Version: 1.0\n";
}else{
$headers.= "\nMIME-Version: 1.0\n";
}
should be
if(empty($headers)){
$headers = "MIME-Version: 1.0\r\n";
}else{
$headers.= "\r\nMIME-Version: 1.0\r\n";
}
also, if you include the MIME-Version header, then the function will include it once more - effectively having two of them.
Have a look at the List of Parser tokens.
T_SL
references to <<
.
You should not use tabs or spaces before you use END;
. Have a look at this huge warning.
A side note, but might well help someone: a bad git merge can cause this. Consider:
function foo
<<<<<<< HEAD
$bar = 1;
<<<<<<< e0f2213bc34d43ef
$bar = 2;
The PHP parser would produce the same error.
Source: just got bit by this ;)
It had the same exact same issue but mine was because I had whitespace at the end of my heredoc on the top line:
$var = <<< HTML(whitespaces here caused the error)
stuff in here
HTML;
Source: http://realtechtalk.com/_syntax_error_unexpected_T_SL_in_PHP_Solution-2109-articles