[wp-hackers] debugging with print_r

Jeremy Visser jeremy.visser at gmail.com
Sat Sep 15 01:15:24 GMT 2007


Ozh wrote:
> function wp_print_r($input, $pre = true) {
> 	if ($pre) echo "<pre>\n";
> 	ob_start();
> 	print_r($input);
> 	$output = ob_get_contents();
> 	ob_end_clean();
> 	$output = attribute_escape($output);
> 	echo $output;
> 	if ($pre) echo "</pre>\n";
> }

Dude, no need for output buffering -- just add "true" as a parameter to
print_r():

	$doesntecho = print_r($input, true);


More information about the wp-hackers mailing list