Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: print_r wrapper

  1. #1
    New Coder
    Join Date
    Jun 2011
    Posts
    56
    Thanks
    0
    Thanked 17 Times in 17 Posts

    print_r wrapper

    This is just a simple little wrapper I always use in development for print_r(). I hate how it is just an enormous string of text, so I just wrap it in pre tags.

    PHP Code:
    function print_arr($array)
    {
         echo 
    '<pre>';
         echo 
    print_r($array);
         echo 
    '</pre>';

    Simple, useful.

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    You can also write that this way so it's one line:
    PHP Code:
    echo '<pre>'print_r($arraytrue), '</pre>'

  • #3
    New Coder
    Join Date
    Jun 2011
    Posts
    56
    Thanks
    0
    Thanked 17 Times in 17 Posts
    Nice, I didn't know about the second argument.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •