Skip to content

Instantly share code, notes, and snippets.

@jrivero
Created May 7, 2013 13:04
Show Gist options
  • Save jrivero/5532394 to your computer and use it in GitHub Desktop.
Save jrivero/5532394 to your computer and use it in GitHub Desktop.
My personal minimalistic var_dump function
<?php
function vd($var, $return=false)
{
$s = var_export($var, true);
$s = preg_replace( '/[^[:print:]]/', '',$s);
$s = preg_replace('#[ ]+#', '', $s);
$s = str_replace(array('array(', ')', '=>', ',]'), array('[', ']', ':', ']'), $s);
if ($return) return $s;
echo $s;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment