PHP print output array content and structure function Print_r and var_dump

Source: Internet
Author: User
Tags php print
PHP print output array content and structure function Print_r and var_dump

Print_r () function

Example:

<?php  $arr _test =array (1, 2, 3); Print_r ($arr _test);? >

Run the example output:

Array (  [0] = 1     [1] = 2     [2] = 3)

Var_dump () function

Example:

<?php$arr_test = Array (1, 2,3); Var_dump ($arr _test);? >

Run the example output:

Array (3) {  [0]=> int (1) [1]=> int (2) [2]=> int (3)}

The Var_dump () function is the same as the Print_r () function usage. However, the Var_dump () function is more powerful than print_r () and can print multiple variables at the same time and give the type information of the variables.


The above describes the PHP print output array content and structure functions Print_r and var_dump, including the aspects of the content, more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!

  • 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.