Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@adrienne
Created August 19, 2010 00:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adrienne/536661 to your computer and use it in GitHub Desktop.
Save adrienne/536661 to your computer and use it in GitHub Desktop.
Some handy PHP utilities that I keep using
/* === quick & dirty PHP pretty-printer for arrays ========================================================== */
function pp($arr){
$retStr = "<dl>\n";
if (is_array($arr)){
foreach ($arr as $key=>$val){
if (is_array($val)){
$retStr .= "<dt>" . $key . " => </dt>\n<dd>" . pp($val) . "</dd>\n";
}
else{
$retStr .= "<dt>" . $key . " => </dt>\n<dd>" . $val . "</dd>\n";
}
}
}
$retStr .= "</dl>\n";
return $retStr;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment