Understanding the usage differences between print EOT and Echo eot in PHP _php tips

Source: Internet
Author: User
Tags tag name
In HTML and PHP writing, echo can output multiple strings at the same time, and does not require parentheses.
Print can output only one string at a time, requiring parentheses.
The use of print is similar to the C language, so you will have a special explanation for the% in the output.
ECHO has no return value, and print () has a return value that returns Flase when its execution fails, such as a disconnection.
Echo can have multiple arguments, print a parameter. It is recommended to use ECHO.

Look at the example below to see what the print <<<eot in PHP is for:
Copy Code code as follows:

Print <<<eot
<body>
$value;

...
</body>
EOT;

Meaning:
<<< operator, which treats the variables between the custom delimiters as strings;
EOT a custom delimiter, at the end of which must be at the beginning of the line;
Use <<< tags on the same page
Mark
Note: The tag name is paired and the same page does not allow more than two tag names to appear in the same name;
Another: The end tag name of the pairing tag name should be on a single line, with no output characters allowed ... (for example, spaces such as invisible but existing characters ...).
Advantages: This allows you to output large segments of HTML without having to escape the inside quotes without having to "automatically replace the variables inside."

How to output HTML code in PHP (EOT)
PHP code
Copy Code code as follows:

<?php
Echo <<< EOT
<table width=80% border= "2" cellpadding= "3" cellspacing= "0" bordercolor= "#808080" >
<tr bgcolor= "#84A9E1" >
<TD align= "center" >ClassID</td>
<TD align= "center" >stuno</td>
<TD align= "center" > Student name </td>
<TD align= "center" > Parent name </td>
<TD align= "center" > Parent Cell phone number </td>
</tr>
EOT;
?>

Detailed Source reference: http://www.jb51.net/article/16022.htm

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.