volter9
volter9

Reputation: 735

Does PHP has interface for print_r or var_dump?

PHP has a lot of built in handy interfaces for usage with different functions. I wonder, is there a interface to handle output for print_r or var_dump?

If there's not, is there another function or/with interface for displaying structured data from class (except __toString)?

Upvotes: 3

Views: 408

Answers (2)

Logan Bailey
Logan Bailey

Reputation: 7147

php 5.6.0 added the __debugInfo() method. It's not an interface, just a method to define on any object. Add this method to set the results of var_dump.

Upvotes: 2

LukeLad
LukeLad

Reputation: 36

If you use print_r and then just copy the output and paste it into an array beautifier(google it) it will make a nice readable output. Its by far the easiest way to check array data within php without a huge amount of work. I use it all the time :)

Good luck!

Upvotes: 0

Related Questions