Output statements in PHP include: echo statement: used to output variables, strings or HTML content, and can output multiple expressions. print statement: only used to output a single expression, with limited functions.
Output statement in PHP
In PHP, the output statement is used to convert variables, strings or HTML Content is sent to a browser or other output device. The most commonly used output statements are echo
and print
.
echo statement
#echo
statement is the most widely used output statement. It can output single or multiple variables, strings or HTML elements. Its syntax is as follows:
<code class="php">echo expression;</code>
print statement
print
statement is similar to the echo
statement, but its functionality is slightly limited. It can only output an expression. The syntax is as follows:
<code class="php">print expression;</code>
Choose echo
or print
statement
Under normal circumstances, it is recommended to use echo
statement instead of print
statement. This is because the echo
statement is more flexible and powerful.
The above is the detailed content of What is the output statement in php. For more information, please follow other related articles on the PHP Chinese website!