Home > Article > Backend Development > Summary of understanding the usage differences between print EOT delimiter and echo EOT in PHP_PHP Tutorial
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 <<
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
echo << ;< EOT
ClassID stuno Student name Parent name Parent mobile phone number
EOT;
?>
Detailed source reference: http://www.jb51.net/article/16022.htm
Related articles
See more