This article mainly introduces the differences between Echo,print_r and Var_dump in PHP, mainly describes the type of the three types of nature and the use of operational data types of differences, very practical value, the need for friends can refer to the next
In this paper, the differences between Echo,print_r and Var_dump in PHP are analyzed in detail. Share to everyone for your reference. The specific analysis is as follows:
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 types of data that operate PHP:
The ①echo is used to output a numeric variable or a string. But when you use echo to output reference variables, such as arrays, only the name of the output array; When an object is output, the server prompts <
Catchable fatal error:object of class person could not be converted
To String>
Error, error display echo can only be used for output strings.
②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.
The output of the ③var_dump (expression) function <变量类型,变量值,变量长度> , which represents the various variable types, is the function of outputting the details of a variable.
I hope this article is helpful to everyone's PHP programming
'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
'). Text (i)); }; $numbering. FadeIn (1700); }); });
The above describes the PHP echo, Print_r and var_dump of the difference analysis, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.