Print_r () function, what is the effect of the 2nd parameter?

Source: Internet
Author: User
This post was last edited by u012314326 on 2013-10-02 17:04:39

http://cn2.php.net/manual/zh/function.print-r.php

1. "Print_r () moves the pointer of the array to the last edge. Use Reset () to get the pointer back to the beginning "
What do you mean by this sentence?

2. "If you want to capture the output of Print_r (), you can use the return parameter. If this parameter is set to TRUE, Print_r () will not print the result (this is the default action), but instead return its output. ”
What do you mean by this sentence?

3. What role does this function have in actual programming?


Reply to discussion (solution)

$arr =array ("1" =>1, "2" =>2);
$result =print_r ($arr, TRUE);
echo $result;

1. "Print_r () moves the pointer of the array to the last edge. Use Reset () to get the pointer back to the beginning "

$ar = Array (' a ' = = 1, ' b ' = + 2); Echo current ($ar); 1print_r ($ar); Echo current ($ar); 1
The description is outdated.

2. "If you want to capture the output of Print_r (), you can use the return parameter. If this parameter is set to TRUE, Print_r () will not print the result (this is the default action), but instead return its output. ”
$ar = Array (' a ' = = 1, ' b ' = + 2); $s = Print_r ($ar, 1);


3. What role does this function have in actual programming?
This function is generally used in the process of debugging
  • Related Article

    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.