php array_intersect()函数使用代码
更新时间:2009年01月14日 00:07:03 作者:
array_intersect() 返回一个数组,该数组包含了所有在 array1 中也同时出现在所有其它参数数组中的值。注意键名保留不变。
array array_intersect ( array array1, array array2 [, array ...])
array_intersect() 函数返回两个或多个数组的交集数组。
array_intersect() 返回一个数组,该数组包含了所有在 array1 中也同时出现在所有其它参数数组中的值。注意键名保留不变。
下面就拿手册上的例子给大家演示:
<?php
$array1 = array ("a" => "green", "red", "blue");
$array2 = array ("b" => "green", "yellow", "red");
$result = array_intersect ($array1, $array2);
print_r($result);
?>
输出结果如下:
Array
(
[a] => green
[0] => red
)
array_intersect() 函数返回两个或多个数组的交集数组。
array_intersect() 返回一个数组,该数组包含了所有在 array1 中也同时出现在所有其它参数数组中的值。注意键名保留不变。
下面就拿手册上的例子给大家演示:
<?php
$array1 = array ("a" => "green", "red", "blue");
$array2 = array ("b" => "green", "yellow", "red");
$result = array_intersect ($array1, $array2);
print_r($result);
?>
输出结果如下:
Array
(
[a] => green
[0] => red
)
相关文章
PHP接入Apple对access_token/identityToken进行JWT验证流程详解
JWT(JSON Web Token)是为了在网络应用环境间传递声明而执行的一种基于JSON的开放标准。本文将为大家介绍PHP如何实现JWT登录鉴权,需要的可以参考一下2022-09-09
最新评论