note 45497 deleted from function.var-dump by nlopess
| From: | nlopess@php.net | Date: | Mon, 20 Dec 2004 12:11:50 +0000 |
| Subject: | note 45497 deleted from function.var-dump by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-82082@lists.php.net to get a copy of this message | ||
Note Submitter: bassboyjan74 at yahoo dot com
----
RE: jsheets v_dump function
I used to do the same thing with the print_r() function, but since var_export came out, I find this
much more useful:
<?php
/**
* @return mixed
* @param mixed $var Variable to export
* @param string $name Name of the variable
* @param bool $echo Weather print it, or return it
* @desc Highlights exported variable
**/
function printr($var, $name='$var', $echo=TRUE) {
$str = highlight_string("<?php\n$name = ".var_export($var, 1).";\n?>\n",
1);
if ($echo) {
echo $str;
} else {
return $str;
}
}
?>
This gives you easy to read PHP code, with color!