This happened in a PHPscript with heredoc but it could really happen anywhere. The issue was whitespace in code like this:
$variable = <<< HTML
some stuff here
Notice on the first line that there is extra white space after the HTML. Whitespace was a deadly killer since it isn't obvious in terms of syntax.