you may get two types of error using heredoc in php.
1.Parse error: syntax error, unexpected T_SL in.....

This will work only for php 5.3 and higher version of php.

or below version.

Solution: this may rise due to use of  ' or " with "heredoc" token

like this

echo <<<'token'
or
echo <<<"token"

This will work only for php 5.3 and higher version of php.

or below version

$sql = <<<SQL
select *
from $tablename
where id in [$order_ids_list]
and product_name = "widgets"
SQL
;

2.Parse error: syntax error, unexpected $end in ...
Solution:
here is the solution to this problem not by me.

you have to place your ending heredoc at the beginning of line. if you use some IDE that have indentation, remove them! your ending heredoc must be vertically in the same line as your ending php tag(
and if still problem persists the use below step too.

Make sure that there is nothing after the 'token'. Even a space will give a parse error. I would delete the line and retype it, hitting <enter> immediately after typing the semi-colon.