发现一个in_array很奇怪的有关问题

WBOY
Release: 2016-06-13 13:33:26
Original
799 people have browsed it

发现一个in_array很奇怪的问题
以下这个明明不在数组里面,但是in_array判断为true,是怎么回事呢?

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->$arr = array('0E372033','0E372034','0E372035','0E372036','0E372037','0E372038','0E372039');

if(in_array('0E372031',$arr)){
    echo "true";
}
else{
    echo "false";
}
Copy after login


我知道in_array('',$arr,true) 这个能判断为false,我就是想知道没加第三个参数时为什么为true

------解决方案--------------------
php 把它当做科学计数法的数了

当 in_array('0E3',$arr) 时,一样是 true
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