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:
Copy codeThe 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 code
Copy 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.