Home > php教程 > php手册 > php中0与空的区别

php中0与空的区别

WBOY
Release: 2016-06-13 09:36:47
Original
872 people have browsed it

作为一个合格的php程序员,一些基础知识是必须要知道的,例如0和空的区别,关于这个区别,下面就通过几个实例进行简单的分析,其中的道理,只可意会,不可言传,读者可以自己去慢慢体会了。

<?php $test=0;

if($test==''){
	echo '<br />在php中,0即为空'; //被输出
}

if($test===''){
	echo '<br>在php中,0即为空'; //不被输出
}

if($test==NULL){
	echo '<br>在php中,0即为空'; //被输出
}

if($test===NULL){
	echo '<br>在php中,0即为空'; //不被输出
}

if($test==false){
	echo '<br>在php中,0即为空'; //被输出
}

if($test===false){
	echo '<br>在php中,0即为空'; //不被输出
}

?>
Copy after login

您可能感兴趣的文章

  • PHP中跳出多重循环使用break,continue,goto,return,exit的用法和区别
  • php中在变量和函数前加static关键字之后的区别
  • php中echo,print,print_r,var_export,var_dump 的用法与区别
  • php中empty,is_null,isset的区别详解
  • ThinkPHP中execute和query方法的区别
  • PHP中return 和 exit 、break和contiue 区别与用法
  • PHP合并数组+与array_merge的区别
  • http请求中同步请求和异步请求的区别
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