Home > php教程 > php手册 > 深入php中var_dump方法的使用详解

深入php中var_dump方法的使用详解

WBOY
Release: 2016-06-13 11:45:55
Original
849 people have browsed it

首先看看实例:

复制代码 代码如下:


$a = "alsdflasdf;a";
$b = var_dump($a);
echo "
";
//var_dump($c);
$d=var_dump($c);
echo "
";
echo $a;
echo "
";
echo $b;
echo "
";
输出:
string(12) "alsdflasdf;a"
NULL
alsdflasdf;a


什么意思呢?var_dump()方法是判断一个变量的类型与长度,并输出变量的数值,如果变量有值输的是变量的值并回返数据类型.此函数显示关于一个或多个表达式的结构信息,包括表达式的类型与值。数组将递归展开值,通过缩进显示其结构。
它的格式:var_dump ( mixed expression [, mixed expression [, ...]] )
来看看var_dump 语法:
var_dump (var,var,bar);
要注意一点,用var_dump里面的变量必须是存在的,如果变量存在但值是空的就会返回false;没有变量则返回NULL.他自己就有输出的功能。不必加其他的输出函数。
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