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