Home >Backend Development >PHP Tutorial >PHP learning—errors caused by delimiter format_PHP tutorial
The following is an incorrect code. Can you see where it went wrong? ? For a beginner like me, everything is vague and I really don’t know where to start. But I really have to try it myself to know what I’m doing wrong. Books and tutorials won’t tell me what I’m doing wrong
Error code: Parse error: syntax error, unexpected $end
in H:wampwww esting est2.1.4.php on line 16
Error source code:
$str = << Test string EOD; echo $str;//Variables used to define delimiters $name = Einstein;$dicta = "Imagination is more important than knowledge, because knowledge is limited, but imagination is unlimited"; $size = 5; echo << said:"{$dicta}" EOT; ?> Eclipse error pictures Error picture This error is actually very simple, that is, at the end of the delimiters EOD and EOT, a Tab is added in front. The solution is to write "EOD;" and "EOT;" in the top box. I believe all beginners have the same experience as me... $str = << Test string Test string EOD; echo $str; //Variable used for delimiter definition $name = Einstein; $dicta = "Imagination is more important than knowledge, because knowledge is limited, but imagination is unlimited"; $size = 5; echo << said:"{$dicta}" EOT; ?>
Test string
Test string
Correct code:
Test string