note 62773 deleted from language.types by colder
| From: | colder@php.net | Date: | Tue, 17 Oct 2006 18:45:57 +0000 |
| Subject: | note 62773 deleted from language.types by colder | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-118656@lists.php.net to get a copy of this message | ||
Note Submitter: carlosreche at yahoo dot com
----
Here is a function to debug any type of variable (excluding "resource" types).
Greets!
<?php
/**
* void debug ( mixed Var [, bool Exit] )
*
* Carlos Reche
* Jan 14, 2006
*/
if (!function_exists("debug")) {
function debug($var, $exit = false) {
echo "\n<pre>";
if (is_array($var) || is_object($var)) {
echo htmlentities(print_r($var, true));
} elseif (is_string($var)) {
echo "string(" . strlen($var) . ") \"" . htmlentities($var) .
"\"\n";
} else {
var_dump($var);
}
echo "</pre>";
if ($exit) {
exit;
}
}
}
?>