Home  >  Article  >  Backend Development  >  Summary of understanding the usage differences between print EOT delimiter and echo EOT in PHP_PHP Tutorial

Summary of understanding the usage differences between print EOT delimiter and echo EOT in PHP_PHP Tutorial

WBOY
WBOYOriginal
2016-07-21 15:41:00908browse

In HTML and PHP writing, echo can output multiple strings at the same time without parentheses.
Print can only output one string at the same time and requires parentheses.
The usage of print is very similar to C language, so % in the output content will be specially interpreted.
echo has no return value, print() has a return value, and returns false when its execution fails (such as disconnection).
echo can have multiple parameters and print can have one parameter. It is recommended to use echo.

Look at the following example to understand what print <<

Copy code Code As follows:

print <<


$value ;

...


EOT;

Meaning:
<<< operator, the content between the custom delimiters is treated as a string, and the variables in between can be processed;
EOT custom delimiter, the end must be at the beginning of the line ;
Use the <<< tag
tag in the same page;
Note: Tag names appear in pairs, and more than two tag names with the same name are not allowed to appear on the same page;
Another: The trailing tagname of the paired tagname should be on a separate line, and characters before and after are not allowed to be output... (such as spaces and other invisible but existing characters...).
Advantages: This way you can output a large section of HTML without escaping the quotes or using "" to automatically replace the variables inside.

How to output html code (EOT) in php
PHP code
Copy code The code is as follows:

echo << ;< EOT







EOT;
?>

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

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/321232.htmlTechArticleWhen writing HTML and PHP, echo can output multiple strings at the same time without parentheses. Print can only output a string at the same time and requires parentheses. The usage of print is very similar to C language, so...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
ClassID stuno Student name Parent name Parent mobile phone number