Debug value helper function
returns a human-readable version of a variable
function dval($val, $print=true, $method='var_export'){
// dval = Debug a VALue -> easy to remember for me
if ($method == 'var_export'){
$r = var_export($val, true);
}
else {
$r = print_r($val, true);
}
if ($print){ print "<pre>[[" . htmlspecialchars($r) . "]]</pre>"; }
else { return "<pre>[[" . htmlspecialchars($r) . "]]</pre>"; }
}
//Example:
$v = array(1,2,3,array(1,2,3));
dval($v);
dval($v, 1, 'print_r');
Url: http://www.jonasjohn.de/snippets/php/dval.htm
Language: PHP | User: ShareMySnippets | Created: Oct 16, 2013