In this way, a large HTML segment can be output without escaping the quotation marks, that is, the usage of echo and print in php is different.
Echo description:
Echo can output multiple strings at the same time without parentheses;
Echo is more like a statement;
Echo is recommended;
Echo 'and so on. I haven't finished writing it yet. Click here. ';
?>
Echo () has no return value, which is the same as the echo Command;
Echo can have multiple parameters, and echo does not return values.
Print description:
Print can only output one string at a time, and parentheses are required.
Print is a function;
The usage of print is similar to that of C language, so it will make a special explanation of % in the output content;
There is no big difference, that is, a function, and a command.
Print can also be used like this
Print <
Php self-learning network
DND
?>
In this way, you can output a large HTML segment without escaping the quotation marks.
Automatically replace the variables
Print a parameter. print has, true, 1; false, 0.
Difference details:
The echo command is the same as the print command, and there is no difference;
The echo function differs from the print function;
Print () has a returned value. if the execution fails (such as disconnection), flase is returned;
Both printf () and sprintf () are formatted outputs. The difference is that the former is output to the standard output, and the latter is output to the variable.
Use in the same page < <标记,标记名为配对出现,同一页面中不允许同名出现两个以上标记名。配对标记名的结尾标记名应单独一行,前后均不允许输出字符...(例如空格等不可见但存在的字符..) 。
Shape
Echo <EOT
EOT;
Print <EOT
EOT;
The format, meaning:
<Operator, which treats the content between custom delimiters as strings and processes the variables
EOT user-defined delimiters. the end must be at the beginning of the line.
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.