Formatted print_r is Darn useful

Here is one of the little improvements upon a php script that makes it even more useful – at least appropriate for browser output. I make no claim to having invented this, its just a useful little script to pass on for debugging arrays in PHP.

function printR($arr, $label= null) {
if($label){
echo “<h2>$label</h2> \n “;
}
echo “\n\n<pre>\n”;
print_r($arr);
echo “\n</pre>\n\n”;
}

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Twitter
  • Reddit
  • Yahoo! Bookmarks
  • Yahoo! Buzz
  • Technorati
  • Add to favorites
  • LinkedIn

Comments are closed.

Dansette