PHP Array Beautifier

Version 3.2

This simple tool takes an array or object output in PHP, such as a print_r() statement and formats it to be easily readable. A new feature includes the ability to expand and contract the array to make things more manageable. In addition, if you would like to re-use the array, you can unserialize the object's serialized string, also exported.
New Fixes (2015.07.10):
  • Added strip slashes to keys
New Fixes (2015.06.11):
  • Escaping Quotes
  • Print in Text format
  • Array Keys can now use 'a' to 'Z' characters, '0' to '9', and '_', '-', ' ', '!', '#', '+', ':'
    Thanks for the find Maarlock

Code to Transform:

Change Log:


  • Escaping Quotes
  • Print in Text Format
  • Array Keys can now use 'a' to 'Z' characters, '0' to '9', and '_', '-', ' ', '!', '#', '+', ':' - Found by Maarlock
  • Rebuilt into Data Model
  • Convert to Object Script
  • Clean Print of Data after Object Encoding
  • Expand and Collapse
  • Serialized Object
  • Route Display


  • Corrections for bad Data
  • Color Coding
  • Example Dump Code


  • Simple Tabbing Export

48 Responses to PHP Array Beautifier

  1. Have you turned this into a class that can be used by other developers or something?

  2. vivek says:

    Thanks Phillihp :)

  3. Rob says:

    This is great. thanks for releasing it

    • Binod says:

      Pretty awesome code, I’ve been klioong to add this to my personal blog, but this will do much better than a plugin =D@Minnesota Attorney, no the code does all the work really, it’s not a built in thing to wordpress.Till then,Jean

  4. Josh Anderson says:

    I broke the array beautifier with some array that I entered into it,

    • Known Issues with v1 and v2: Extra added parenthesis
      v3 accounts for most of these using Regex searches instead of simple iterative character searches.
      Note, there are still off-cases that can break it. The nature of the print_r format.

  5. Luca says:

    Very useful, thank you very much!!!

  6. Stefan says:

    Is the Source code for this availible somewhere? Would be awesome :D

  7. sharath says:

    thank u.. its beautiful

  8. genevieve says:

    very useful, thank you!

  9. Timofey says:

    I would be great to see collapsible rows!

  10. toufik_at says:

    Works like a charm, thanks

  11. Kimberly says:

    Works well! It is not obvious, thugoh. Will new users know to click on the yellow bubble or time stamp?Within the thread itself, perhaps you can put the same yellow bubble next to the title of the thread to keep things consistent? Maybe a yellow bubble with a down arrow?

  12. Jimmy Arogen says:

    Thank you! Would you consider making a Chrome extension, or a firefox one? That would be even more awesome :)

  13. Very useful. Thanks alot!

  14. Won JeonHwan says:

    Thanks! its pretty great and useful!!!

  15. Won JeonHwan says:

    Thanks all your trying! It’s pretty useful and Great!!!

  16. SkY2kv says:

    Pretty much good…

  17. Damir says:

    Thanks for service. Helps a lot.

  18. Zain Saqer says:

    Very helpful thanks

  19. Nick Julia says:


    Thanks for making this. It saved me alot of time!


  20. Caedmon says:

    Bookmarked. This is so useful, thank you.

  21. Luka Kraljevic says:

    This is awesome!

  22. drrk says:

    Simply beautiful! Thanks a million!

  23. AndyG says:

    Philip – this is really great, thanks for sharing it. Andy

  24. Thank you for this perfect Tool

  25. Bart says:

    Wow man I’ve been using this for quite a while now and it saved me sooo much time.
    Thanks a lot, really appreciated!

    Maybe an extra useful feature, especially for large multidimensional arrays:
    The possibility to expand and contract each array (with a minus and plus icon in front of each array).
    This way you have a lot more overview and you need to scroll less.


  26. Thanks so much for this, so useful! Bookmarked!

  27. Yuki AY says:

    Thank you so much . its works great and still using it ~~ =D


  28. Pingback: Wicked sick tools to help build and enhance your wesbites

  29. Rifqi says:

    Hi thanks bro, your tools help me ;)

  30. Maarlock says:

    Hi man, thanks a lot for this tool, I’m using it all the time !
    However since you updated it I have a problem :

    If I try to beautify an array with number as indexes like this :
    Array ( [0] => this [1] => is [2] => Array ( [0] => a [1] => test ) )
    it doesn’t work.

    But if I replace numbers by letters, there is no problem, the beautified array is perfect :
    Array ( [a] => this [b] => is [c] => Array ( [d] => a [e] => test ) )

    Is it me doing it wrong or do you have a problem ?

    • Great Catch! That was an issue on my end. The new code searches for regular expressions. Apparently, I only had, lowercase a to z and uppercase A to Z.


      I went ahead and added digits, underscores, dashes, and spaces (although that is bad practice, I’ve seen it done.


      Give it another try. let me know if that fixes it for you.

  31. Ken says:

    Is it possible to use the old version of your beautifier somewhere? It helped me out a lot :)

  32. Maarlock says:

    It seems to be perfect now, thanks ! :-)

  33. Ken says:

    Awesome , thanks you :) !

  34. Giomar MG says:

    I think there’s a problem when I have an array with quotation marks in the v3, for example if I have a key [ABC's] => Array (Content)
    It will read it as [ABC/'s] => “Array (” [Content]
    v2 works fine with that, thanks

Add Comment Register

Leave a Reply to Phillihp Harmon Cancel reply

Your email address will not be published. Required fields are marked *

ERROR: si-captcha.php plugin says GD image support not detected in PHP!

Contact your web host and ask them why GD image support is not enabled for PHP.

ERROR: si-captcha.php plugin says imagepng function not detected in PHP!

Contact your web host and ask them why imagepng function is not enabled for PHP.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>