PHP echo,print_r (expression), var_dump (expression) difference

Source: Internet
Author: User

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,

    1. 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.
    2. 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.
    3. 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

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.