Home > Article > Backend Development > Tools | PHP formatted output array
function dump($vars, $label = '', $return = false) {
if (ini_get('html_errors')) {
$content = "\n";
if ($label != '') {
$content .= "{$label} :\n";
}
$content .= htmlspecialchars(print_r($vars, true));
$content .= "\n
\n";
} else {
$content = $label . " :\n" . print_r($vars, true);
}
if ($return) { return $content; }
echo $content;
return null;
}
Reference:
http://www.birdol.com/web/751.html
The above has introduced the tool | PHP formatted output array, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.