note 45526 deleted from function.var-dump by tomsommer
| From: | tomsommer@php.net | Date: | Thu, 09 Sep 2004 20:24:05 +0000 |
| Subject: | note 45526 deleted from function.var-dump by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-76345@lists.php.net to get a copy of this message | ||
Note Submitter: cesschneider at users dot sf dot net
----
This is a more sofisticated variable dump function.
/**
* Dump array values
*
* @param mixed $variable variable to be dumped
* @param bool $print return/print variable values
* @param string $dump_function function used to dump variable
*/
function dump($variable, $print = TRUE, $dump_function = 'print_r')
{
ob_start();
$dump_function($variable);
$content = ob_get_contents();
ob_end_clean();
if ($print)
{
if (ini_get('html_errors'))
{
$output = '<font face="Verdana" size="2">';
$output .= str_replace(chr(32),' ', nl2br($content));
$output .= "</font>\n";
}
print $output;
}
else {
return $content;
}
}