The difference between Echo and print is that echo can output multiple variable values, while print has only one variable as a string output. The other difference is that ECHO has no return value, and print has a return value of 1.print and cannot output arrays and objects.
Print_r can output stirng, int, float, array, object, etc., the output array will be represented by the structure, the Print_r output is true when successful;
And Print_r can return Print_r-processed values by Print_r ($STR, true) so that Print_r does not output.
In general, the dynamic output of HTML content in PHP is achieved through print and ECHO statements, and in practice, both print and ECHO functions are almost identical. It can be said that there is a place to use, and the other can be used. However, there is also a very important difference between the two: in the Echo function, you can output multiple strings at the same time, and in the print function you can only output one string at a time. At the same time, the Echo function does not require parentheses, so the echo function is more like a statement than a function.
Echo and print are not functions, but language constructs, so parentheses are not required.
The difference between echo print Print_r in PHP