Home >Backend Development >PHP Tutorial > PHP中的''、零、null 相等?

PHP中的''、零、null 相等?

WBOY
WBOYOriginal
2016-06-13 13:03:231115browse

PHP中的''、0、null 相等?!
猜猜以下代码输出结果,初学php语言,跟java比,输出结果让我有点吃惊


//$str1,$str2='';//语法有错误
$str1=null;
$str2='';

if($str1==0)
	echo "相等";
else
	echo "不等";
	
echo '<br>','<br>','<br>';
	
if($str2==0)
	echo "相等";
else
	echo "不等";

Statement:
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