Differences between print EOT and echo EOT in PHP

Source: Internet
Author: User

Echo in HTML and PHP can output multiple strings at the same time without parentheses.
Print can only output one string at a time, and parentheses are required.
The usage of print is similar to that of C language, so it will make a special explanation of % in the output content.
ECHO has no return value, and print () has a return value. flase is returned when its execution fails (such as disconnection.
ECHO can have multiple parameters and print one parameter. ECHO is recommended.

Let's take a look at the following example to understand what print <EOT is used in PHP:CopyCodeThe Code is as follows: Print <EOT
<HTML>
<Head> <Body>
$ Value;

...
</Body>
<HTML>
EOT;

Meaning:
<Operator, which treats the content between user-defined delimiters as strings and processes the variables in them;
EOT custom delimiters. The end must be at the beginning of the line;
Use the <tag
Mark;
Note: When tag names are matched, two or more tag names cannot appear on the same page with the same name;
In addition, the end tag name of the paired tag name should be a separate line, and no leading or trailing characters can be output... (such as spaces and other invisible but existing characters ..).
Advantage: in this way, you can output a large HTML segment and automatically replace the variables in it without escaping the quotation marks.

How to output HTML code (EOT) in PHP)
PHP codeCopy codeThe Code is 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"> parents' mobile 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.