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

yipeiwu_com6年前PHP代码库
这个很早就有了,比php自带的var_dump好用多了。
复制代码 代码如下:

function dump($vars, $label = '', $return = false) {
if (ini_get('html_errors')) {
$content = "<pre>\n";
if ($label != '') {
$content .= "<strong>{$label} :</strong>\n";
}
$content .= htmlspecialchars(print_r($vars, true));
$content .= "\n</pre>\n";
} else {
$content = $label . " :\n" . print_r($vars, true);
}
if ($return) { return $content; }
echo $content;
return null;
}

相关文章

php项目中类的自动加载实例讲解

主要函数:spl_autoload_register() — 注册给定的函数作为 __autoload() 的实现 将函数注册到SPL __autoload函数队列中。如果该队列中的函数...

php购物网站支付paypal使用方法

详细参考: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_htm...

PHP中VC6、VC9、TS、NTS版本的区别与用法详解

1. VC6与VC9的区别: VC6版本是使用Visual Studio 6编译器编译的,如果你的PHP是用Apache来架设的,那你就选择VC6版本。 VC9版本是使用Visual S...

PHP 字符串正则替换函数preg_replace使用说明

1. preg_replace() $msg = preg_replace("/<style>.+<\/style>/is", "", $msg); -----删...

php变量范围介绍

例如: 复制代码 代码如下: <?php $a = 1; include 'b.inc'; ?> 这里变量 $a 将会在包含文件 b.inc 中生效。但是,在用户自定义函数...