0

This code:

<?
echo <<<EOM 
Hello
EOM;
?>

Results in this error:

Parse error: parse error in C:\xampp\htdocs\tiketku\cari.php on line 2

What am I doing wrong?

Trott
  • 66,479
  • 23
  • 173
  • 212
mat danz
  • 27
  • 1
  • 3

3 Answers3

11

You have a space after <<<EOM. This is illegal. Remove the space and it will work fine.

From the manual:

A third way to delimit strings is the heredoc syntax: <<<. After this operator, an identifier is provided, then a newline.

You can't have whitespace between the identifier and the new line.

lonesomeday
  • 233,373
  • 50
  • 316
  • 318
4

You have a space ␣ after the EOM.

<?
echo <<<EOM␣
Hello
EOM;
?>

You need to remove it.

mario
  • 144,265
  • 20
  • 237
  • 291
2

You have an extra space character after the first "EOM"!

zaf
  • 22,776
  • 12
  • 65
  • 95