In PHP, echo and print can both be used for output statements, but there are some usage differences between them. 1. In the official PHP manual, echo and print are not actually a function. They are a language structure and do not need to use parentheses to expand the parameter list behind print. Echo does not return, and print does. 2. echo can output strings,
In PHP, echo and print can both be used for output statements, but there are some usage differences between them. 1. In the official PHP manual, echo and print are not actually a function. They are a language structure and do not need to use parentheses to expand the parameter list behind print. Echo does not return, and print does. 2. echo can output strings,
In PHP, echo and print can both be used for output statements, but there are some usage differences between them.
1. In the official PHP manual, echo and print are not actually a function. They are a language structure and do not need to use parentheses to expand the parameter list behind print. Echo has no return value, and print has a return value.
2. echo can output strings separated by commas. Print can output only one string. That is to say, echo can receive different parameters, and print can only accept one parameter.
"." My age is 20 "."
"," My college is in Beijing ","
"; Print" my hometown is in Beijing ";?>
Tip: (1) because echo does not return values at runtime, it is slightly more efficient than print, which is suitable for some relatively simple outputs.
(2) Because print has a return value, false is returned when the output fails, so it is suitable for some complicated expressions.