[wp-hackers] debugging with print_r
Keith Constable
kccricket at gmail.com
Sat Sep 15 06:24:32 GMT 2007
Jeremy Visser wrote:
> 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);
To be fair, IIRC, print_r() uses the output buffering routines
internally to capture and return the information.
-Keith Constable
http://kccricket.net
More information about the wp-hackers
mailing list