Created
September 15, 2011 15:59
-
-
Save oranj/1219648 to your computer and use it in GitHub Desktop.
dump
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (! function_exists('dump')) { | |
// Human readable print_r rendered by the browser. | |
function dump($var, $return = false) { | |
$str = '<pre style="text-align:left; border:1px solid #ccc; color:#000; background:#fff; margin:10px; padding:10px; background:rgba(255,255,255,0.7);">'.htmlentities(print_r($var, true)).'</pre>'; | |
while (preg_match('/((?!\[\[)([0-9]{10})(?!\]\]))/', $str, $matches)) { | |
$str = preg_replace('/'.$matches[1].'/', '{<strong>'.date('r', $matches[1])."</strong> <em>[[".$matches[1]."]]</em>}", $str); | |
} | |
if ($return) { return $str; } echo $str; | |
} | |
} |
now replaces 10 digit numbers with 'r' formatted dates.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Added styling to help when things are center aligned;