Welcome to ManageWP.org

Register to share, discuss and vote for the best WordPress stories every day, find new ideas and inspiration for your business and network with other members of the WordPress community. Join the #1 WordPress news community!

×

PHP – Print a Prettier Array

surniaulula.com | Mar. 21, 2016 | 3 min read

I often want to output an array for debugging purposes, but using var_dump() or print_r() on an array that includes true / false values and class objects can be problematic -- false values appear empty, and class objects can include too much information. I wrote the following recursive static method (presented here as a function) to pre-filter an array for readability when using print_r() or var_dump().

14 votes   Flag