[wp-hackers] debugging with print_r

Dan Kuykendall dan at kuykendall.org
Sat Sep 15 01:05:08 GMT 2007


I ran into the same thing, and ended up creating these two functions
that I use all the time


function html_print_r($v, $n = '', $ret = false) {
 if($ret) {
  ob_start();
 }	
 echo $n.'<pre>';
 print_r($v);
 echo '</pre>';
 if($ret) {
  $result = ob_get_contents();
  ob_end_clean();
  return $result;
 }
}

function comment_print_r($v, $n = '', $ret = false) {
 $result = "<!-- \n";
 $result .= html_print_r($v, $n, true);
 $result .= " -->\n";
 if($ret) {
  return $result;
 }
 echo $result;
}


-- 
Dan Kuykendall (aka Seek3r)
http://www.mightyseek.com

The ultimate security is your understanding of reality.


More information about the wp-hackers mailing list