Home > Backend Development > PHP Problem > What is the difference between echo and print in php

What is the difference between echo and print in php

王林
Release: 2023-02-28 18:04:01
forward
2798 people have browsed it

What is the difference between echo and print in php

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 "这是一个字符串输出";
Copy after login

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!

Related labels:
source:cnblogs.com
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template