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

PHP var_dump()

WBOY
Release: 2016-06-13 10:45:41
Original
1897 people have browsed it

 

php var_dump 函数作用是判断一个变量的类型与长度,并输出变量的数值,如果变量有值输的是变量的值并回返数据类型.此函数显示关于一个或多个表达式的结构信息,包括表达式的类型与值。数组将递归展开值,通过缩进显示其结构。

它的格式:var_dump ( mixed expression [, mixed expression [, ...]] )

来看看var_dump 语法:

 

var_dump (var,var,bar);

下面来看看我刚才的一个实例吧.

$ta =1;

$tb =’t';

echo var_dump($ta,$tb);

?>

 

输出为

 

int(1) string(1) “t”

 

第一个为数字就是int(1)

 

简单吧,不过要注意一点,用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