不区分大小写,查找数组,有这样的函数么?

WBOY
Release: 2016-06-23 14:23:47
Original
1250 people have browsed it

本帖最后由 u012362664 于 2013-10-09 19:52:48 编辑

不区分大小写字母或字符

回复讨论(解决方案)

你就不能在手册中找找吗?

你就不能在手册中找找吗?

N个,不知怎查找?

in_array() 

type 可选。如果设置该参数为 true,则检查搜索的数据与数组的值的类型是否相同。

亲,你也是独生子吧

in_array() 

type 可选。如果设置该参数为 true,则检查搜索的数据与数组的值的类型是否相同。

给个实例!


in_array() 

type 可选。如果设置该参数为 true,则检查搜索的数据与数组的值的类型是否相同。

给个实例!

打开网址:http://www.baidu.com/
输入:in_array,然后点击 “百度一下”
选择第一行打开

楼主不会百度 ……

in_array() 

type 可选。如果设置该参数为 true,则检查搜索的数据与数组的值的类型是否相同。

in_array( )函数只区分类型。

不区分大小写字母,或字符。有这样的函数么?

如果你找遍了手册也没找到的话,那么就自己写一个

$ar = array('A', 'b', 'C');var_dump(in_iarray('B', $ar));function in_iarray($c, $a, $f=false) {  return in_array(strtolower($c), array_map('strtolower', $a), $f);}
Copy after login
Copy after login

如果你找遍了手册也没找到的话,那么就自己写一个

$ar = array('A', 'b', 'C');var_dump(in_iarray('B', $ar));function in_iarray($c, $a, $f=false) {  return in_array(strtolower($c), array_map('strtolower', $a), $f);}
Copy after login
Copy after login


bool in_array ( mixed $needle , array $haystack [, bool $strict = FALSE ] )
Copy after login


 bool $strict = FALSE

函数in_array( ),第3个参数的类型是:布尔类型。
$strict,是什么意思?

strict 严格

$strict = true 时,比较时同时检查类型

strict 严格

$strict = true 时,比较时同时检查类型

第3个参数,可以这样写:
1)$strict = true
2)$strict = false
3)true
4)false

对否?

是的!可以这样写


     

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!