All three are PHP statements with output functionality, but print_r (expression), var_dump (expression) is a function, and Echo is simply a language structure, not a function, and therefore cannot be part of an expression.
For the 8 data types in PHP,
- echo is used to output a numeric variable or a string. But when you use echo to output a reference variable, such as an array, only the names of the arrays are output; When an object is output, the server prompts <catchable fatal error:object of class person could is Converted to string> error, error display echo can only be used for output string.
- Print_r (expression) is the output of an array, in fact the type of the argument expression can be a numeric variable and a reference variable.
- Output of the var_dump (expression) function < variable type, variable value, variable length; The argument expression represents a variety of variable types, and the function is to output the details of a variable.
PHP echo,print_r (expression), var_dump (expression) difference