The difference analysis of Echo, Print_r and Var_dump in PHP

Source: Internet
Author: User

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.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.