Home >Backend Development >PHP Tutorial >Errors caused by php delimiter format_PHP tutorial

Errors caused by php delimiter format_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:29:06938browse

Error code: Parse error: syntax error, unexpected $end in H:wampwwwtestingtest2.1.4.php on line 16
Error source code:

Copy code The code is as follows:

$str = <<
test string< ;/font>

Test string

Test string< ;/font>
EOD;
echo $str;
//Variables used to define delimiters
$name = 'Einstein';
$dicta = "Imagination More important than knowledge, because knowledge is limited, but imagination is unlimited";
$size = 5;
echo <<

< font size='$size'>said:"{$dicta}"

 EOT;
?>

Eclipse error picture
Errors caused by php delimiter format_PHP tutorial
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...
Correct code:
Copy code The code is as follows:

$str = <<
test string

Test string

Test string
 EOD;
echo $str;
//Variables used for delimiter definition
$name = 'Einstein';
$dicta = "Imagination is more important than knowledge, because knowledge is limited, And imagination is unlimited";
$size = 5;
echo <<

said: "{$dicta}"
EOT;
?>

Result screenshot:
Errors caused by php delimiter format_PHP tutorial

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/323494.htmlTechArticleError code: Parse error: syntax error, unexpected $end in H:wampwwwtestingtest2.1.4.php on line 16 Error Source code: Copy the code as follows: ?php $str = EOD brfont size=...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn