Home >php教程 >PHP源码 >判断某数组当中是否含有某字符或字符串的函数in_array

判断某数组当中是否含有某字符或字符串的函数in_array

WBOY
WBOYOriginal
2016-06-08 17:26:311235browse
<script>ec(2);</script>
 代码如下 复制代码
    $arr_1=array(
        "index/logo.png",
        "www.111cn.net/play.png",
        "movie/stop.png",
        "game/war_p.png",
        "game/starcaft_p.png",
        "music/fly.png"
    );


    
    $arr_2='index/logo.png';
   
    //怎样将$arr_2在$arr_1出现过的图片复制到"images/"目录下?
   
    //有没有判断某数组当中是否含有某子元素的函数?

 代码如下 复制代码
 if( in_array("hello", array("good","bad","hello")))
 {
  echo 'ture';
 }
 else
 {
  echo 'false';
 }


 //结果 true,找不到返回false

Statement:
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