1. The difference between the two
echo supports multiple string output, separated by commas (,), print only supports one string output;
echo output speed is faster than print;
echo has no return value, and the return value of print is always 1.
Free learning video tutorial sharing: php video tutorial
2. Use
echo is a language structure function, which can be used with (), or No parentheses are required.
For example:
echo ("这是一个字符串输出"); echo "这是一个字符串输出";
The usage of print is the same as echo.
Recommended related articles and tutorials: php tutorial
The above is the detailed content of What is the difference between echo and print in php. For more information, please follow other related articles on the PHP Chinese website!