note 45497 added to function.var-dump
| From: | bassboyjan74 at yahoo dot com | Date: | Thu, 09 Sep 2004 06:46:00 +0000 |
| Subject: | note 45497 added to function.var-dump | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-76274@lists.php.net to get a copy of this message | ||
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!
----
Manual Page -- http://www.php.net/manual/en/function.var-dump.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+45497
Delete -- http://master.php.net/manage/user-notes.php?action=delete+45497&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+45497&report=yes
Search -- http://master.php.net/manage/user-notes.php