Home > Backend Development > PHP Tutorial > PHP learning—errors caused by delimiter format_PHP tutorial

PHP learning—errors caused by delimiter format_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 17:43:47
Original
1072 people have browsed it

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


Test string

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

PHP learning—errors caused by 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:


$str = <<


Test string

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;

?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478802.htmlTechArticleThe 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 where to go...
source:php.cn
Statement of this Website
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template