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

WBOY
Release: 2016-06-13 13:03:23
Original
1083 people have browsed it

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 "不等";

Copy after login

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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template