好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

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

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

实例代码如下:

$arr_1 = array (        "index/logo.png" ,        "HdhCmsTestphpfensi测试数据/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.

查看更多关于判断某数组当中是否含有某字符或字符串的函数的详细内容...

  阅读:46次