Posted By

the_dev on 07/07/09


php array

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


Print Array for Debugging

 / Published in: PHP

It's easy to print out an array that is readable and with only one line of code. This can easily be turned into a nifty function.

  1. // The One liner
  2. // The <pre> tags make it looks nice and neat and readable.
  3. <pre><? print_r($array); ?></pre>
  6. // The function
  7. function pretty_print($array) {
  8. echo "<pre>";
  9. print_r($array);
  10. echo "</pre>";
  11. }

Report this snippet  

You need to login to post a comment.