Home > php教程 > php手册 > body text

php中自定义函数dump查看数组信息类似var_dump

WBOY
Release: 2016-06-06 20:25:20
Original
1404 people have browsed it

本文为大家介绍下在php中自定义函数dump查看数组信息,具体示例如下,希望对大家有所帮助

这个很早就有了,比php自带的var_dump好用多了。

复制代码 代码如下:


function dump($vars, $label = '', $return = false) {
if (ini_get('html_errors')) {
$content = "

\n"; <br>if ($label != '') { <br>$content .= "<strong>{$label} :</strong>\n"; <br>} <br>$content .= htmlspecialchars(print_r($vars, true)); <br>$content .= "\n
Copy after login
\n";
} else {
$content = $label . " :\n" . print_r($vars, true);
}
if ($return) { return $content; }
echo $content;
return null;
}
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!