Error _php techniques caused by PHP delimiter format

Source: Internet
Author: User
Tags error code parse error
Error code: Parse error:syntax Error, unexpected $end in H:\wamp\www\testing\test\2.1.4.php on line 16
Error source code:
Copy Code code as follows:

<?php
$str = <<<eod
<br><font size= ' 2 ' > Test string </font>
<br><font size= ' 3 ' > Test string </font>
<br><font size= ' 4 ' > Test string </font>
EOD;
Echo $str;
Define the variables used for the delimiter
$name = ' Einstein ';
$dicta = "Imagination is more important than knowledge, because knowledge is limited, and imagination is infinite";
$size = 5;
Echo <<<eot
<br>
<font size= ' $size ' >said: ' {$dicta} ' </font>
EOT;
?>

Eclipse Error Picture

Error picture
This error is actually very simple, that is, at the end of the delimiter EOD and EOT, the Front tab, the solution is below write "EOD;" and "EOT;" I believe you beginners have the same experience as me ...
Correct code:
Copy Code code as follows:

<?php
$str = <<<eod
<br><font size= ' 2 ' > Test string </font>
<br><font size= ' 3 ' > Test string </font>
<br><font size= ' 4 ' > Test string </font>
EOD;
Echo $str;
Define the variables used for the delimiter
$name = ' Einstein ';
$dicta = "Imagination is more important than knowledge, because knowledge is limited, and imagination is infinite";
$size = 5;
Echo <<<eot
<br>
<font size= ' $size ' >said: ' {$dicta} ' </font>
EOT;
?>

Results screenshot:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.