今日犯2了 当永记 PHP TRUE == 2

WBOY
Release: 2016-06-13 12:41:50
Original
779 people have browsed it

今天犯2了 当永记 PHP TRUE == 2

今天同事测试 投票功能 始终报已投过票的提示,仔细检查了下代码,也没有发现问题出在哪里?

?

最后一行行的排查才发现 原来是 bool == 整数 这个问题

?

$str=" ";

var_dump( empty($str)? );

exit;

?


$str = "1";
var_dump($str[0]);
$str = implode('|',$str);
//var_dump($str);


exit;

$a = 1==1;
$b = 2 == $a;

var_dump($b);
br( "\$b = " . $b );

var_dump(TRUE == 2);


exit;

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