php字符串比较:"" == "" 返回false

WBOY
Release: 2016-06-06 20:24:35
Original
1401 people have browsed it

判断"" == ""居然返回false,前一个双引号是从数据库取出处理数据时得到到,后一个双引号是用编辑器敲出来的,比较的结果是false,是编码的问题还是隐藏字符的问题呢?有什么比较好的检测方法吗?

回复内容:

判断"" == ""居然返回false,前一个双引号是从数据库取出处理数据时得到到,后一个双引号是用编辑器敲出来的,比较的结果是false,是编码的问题还是隐藏字符的问题呢?有什么比较好的检测方法吗?

"" 中间有一个字符,用json_encode输出后是\ufeff

编码问题。

<code><?php if( "" == ""){
    echo "1";
}else{
    echo "0";//这里真的输出0了,我也很奇怪
}
var_dump("");//复制第一个“”,发现时编码问题
</code></code>
Copy after login

php字符串比较:

Related labels:
php
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