The PHP function printarray () cannot output objects.

Source: Internet
Author: User

Disadvantages of the PHP function printarray (): The print_r () object cannot be output.

  1. Printarray ($ _ REQUEST );
  2. Function printarray ($ strs,
    $ Numbers = 0 ){
  3. $ Space = ''; // space before the output character
  4. For ($ I = 0; $ I<$ Numbers * 2; $ I ++)
  5. $ Space. = '& nbsp ;';
  6. Echo 'array<Br/>'. $ Space .'(<Br/>';
  7. Foreach ($ strs as $ key =>$ Value ){
  8. If (is_array ($ value )){
  9. $ Numbers ++;
  10. Echo $ space. '['. $ key. '] =>';
  11. Printarray ($ value, $ numbers );
  12. } Else {
  13. Echo $ space. '& nbsp; ['. $ key. '] =>'
    . $ Value .'<Br/>';
  14. }
  15. }
  16. Echo $ space .')<Br/>';
  17. }

The output content of the PHP function printarray () is as follows:

 
 
  1. Array   
  2. (   
  3. [ECS] => Array   
  4. (   
  5. [visit_times] => 2   
  6. )   
  7. [uchome_loginuser] => yoyorose   
  8. [rrm_cookietime] => 2592000   
  9. [rrm_indextype] => classics   
  10. [uchome_mytemplate] => blue   
  11. [rrm_loginuser] => yoyorose   
  12. [rrm_activationauth] => 6f474pFbxW4oV
    /XdtU+eyoMUxpRCx6A+0GMR4SUR/8GlagURxA   
  13. [ZDEDebuggerPresent] => PHP,phtml,PHP3   
  14. [uchome_auth] => 821bVB9QFgrH+4uv07tQ6q
    CRYK9OueeM/j5gqXCJfmUZh3gptW6dP3phCqPufV
    ZnYY3qCtuW7h1vrLxEemQG   
  15. [uchome_viewuids] => 10_1_2_4_11_8_9_7   
  16. [uchome_space_top_show] => 1   
  17. [uchome_space_top_experience] => 2   
  18. )  


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.