Home > Backend Development > PHP Tutorial > 函数参数:true?该怎么解决

函数参数:true?该怎么解决

WBOY
Release: 2016-06-13 12:35:08
Original
827 people have browsed it

函数参数:true?

本帖最后由 u012362664 于 2013-10-09 20:35:48 编辑
<br />
<?<br />
<br />
     $x1=array(1=>111,2=>12,3=>3333);<br />
     $y1=in_array(12,$x1,true);<br />
     echo $y1;<br />
     echo "\r\n";<br />
     <br />
     $x2=array(1=>111,2=>12,3=>3333);<br />
     $y2=in_array('12',$x2,true);     <br />
     echo $y2;<br />
     echo "\r\n";<br />
     <br />
     $x3=array(1=>111,2=>12,3=>3333);<br />
     $y3=in_array("12",$x3,true);    <br />
     echo $y3;<br />
     echo "\r\n";<br />
    <br />
?><br />
Copy after login


程序输出:
1
0
0


问题:
1.上面程序编译,没语法错误。
   函数in_array( ),第1个参数,都是int整型。

   函数in_array( ),第3个参数:true,有什么作用?
   
   为什么,第1个数组,返回结果:1,找到。
   每2,3个数组,返回结果:0,找不到?
  

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