Revision: 49078
Updated Code
at July 15, 2011 15:50 by philsown
Updated Code
function dump($var, $exit = false) { if(is_string($var) && '' == $var) { $var = 'string(0) ""'; } elseif(is_array($var) && empty($var)) { $var = 'array(0) empty'; } elseif(is_bool($var)) { $var = 'boolean ' . ((true === $var) ? 'true' : 'false'); } elseif(null === $var) { $var = 'null'; } echo '<pre>', print_r($var, true), '</pre>'; if(true == $exit) { exit('<pre>dump exit</pre>'); } }
Revision: 49077
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 15, 2011 15:48 by philsown
Initial Code
function dump($var, $exit = false) { if(is_string($var) && '' == $var) { $var = 'string(' . strlen($var) . ') ""'; } elseif(is_array($var) && empty($var)) { $var = 'array(0) empty'; } elseif(is_bool($var)) { $var = 'boolean ' . ((true === $var) ? 'true' : 'false'); } elseif(null === $var) { $var = 'null'; } echo '<pre>', print_r($var, true), '</pre>'; if(true == $exit) { exit('<pre>dump exit</pre>'); } }
Initial URL
Initial Description
For when xDebug is not enabled and you want to echo/dump a variable. Shorter than: <pre> var_dump($something); exit;</pre> if you use the $exit argument. Also shorter than: <pre>echo "<pre>"; var_dump($something); echo "</pre>"; exit;</pre> too.
Initial Title
Dump function for when there\'s no xDebug present.
Initial Tags
Initial Language
PHP