博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
intersect函数_PHP array_intersect()函数与示例
阅读量:2529 次
发布时间:2019-05-11

本文共 1074 字,大约阅读时间需要 3 分钟。

intersect函数

PHP array_intersect()函数 (PHP array_intersect() Function )

array_intersect() function is used to find the matched elements from two or more elements. Function “array_intersect()” compares the values of the first array with the other arrays and returns matched elements.

array_intersect()函数用于从两个或多个元素中查找匹配的元素。 函数“ array_intersect()”将第一个数组的值与其他数组进行比较,并返回匹配的元素。

Syntax:

句法:

array_intersect(array1, array2, [array3,...]);

Here, array1, array2 are the input arrays other arrays are an optional.

在这里, array1 , array2是输入数组,其他数组是可选的。

Examples:

例子:

Input:    $arr1 = array("Hello", "Hi", "Okay", "Bye!");    $arr2 = array("Okay", "Hello", "Bye", "Hi");    Function calling:     array_intersect($arr1, $arr2);    Output:    Array    (        [0] => Hello        [1] => Hi        [2] => Okay    )

PHP code 1: Comparing two string arrays.

PHP代码1:比较两个字符串数组。

Output

输出量

Array(    [0] => Hello    [1] => Hi    [2] => Okay)

PHP code 2:Comparing three arrays with strings & numbers.

PHP代码2:将三个数组与字符串和数字进行比较。

Output

输出量

Array(    [3] => Hello    [6] => 50)

翻译自:

intersect函数

转载地址:http://bgxzd.baihongyu.com/

你可能感兴趣的文章
09 audio和vedio标签
查看>>
Jmeter实现线程阶梯式加压
查看>>
Java 反射 getFields() vs getDeclaredFields ()
查看>>
DP题 总结 [更新中]
查看>>
python安装教学
查看>>
JQuery制作简单的网页导航特效
查看>>
操作系统简述
查看>>
设计模式大总结2-结构型模式
查看>>
【Python】不定期更新学习小问题整理
查看>>
Zico源代码分析:执行启动过程分析和总结
查看>>
Android之Http通信——1.初识Http协议
查看>>
hdu5044(二分)
查看>>
静态路由、缺省路由的作用
查看>>
linux快捷键绝对路径相对路径讲解
查看>>
又漏一次
查看>>
dede模板中plus文件路径使用方法
查看>>
xml解析demo使用
查看>>
python使用模板手记
查看>>
No result defined for action com.nynt.action.ManageAction and result input问题
查看>>
iOS开发拓展篇—UIDynamic(重力行为+碰撞检测)
查看>>