Posts Tagged print_r
Formatted print_r is Darn useful
Posted by pbg in General, Web Development, php on November 11th, 2008
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”;
}