What are the basic output methods of php
This article mainly introduces "what are the basic output methods of php". In daily operation, I believe many people have doubts about the basic output methods of php. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "what are the basic output methods of php?" Next, please follow the editor to study!
The two basic output methods of php are "echo" and "print". Echo is used to output one or more strings, can accept multiple parameters and no return value, syntax "echo ($str)", while print is used to output a string, which can only accept one parameter and return value, syntax "print ($str)".
Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
In PHP, there are two basic output methods: echo and print.
The difference between echo and print
Echo-outputs one or more strings, can accept multiple parameters and has no return value
Print-can output only one string, can only accept one parameter and has a return value, and always returns 1
Tip: echo is slightly faster than print because it does not return any values.
PHP echo statement
1.echo is a language structure that can be used with or without parentheses: echo or echo ()
two。 Display strings, the following example shows how to use the echo command to display different strings (and note that strings can contain HTML tags)