简体   繁体   English

有没有办法用键值PHP的组合来过滤数组

[英]is there any way to filter array with a combination of key value PHP

how can i filter an array using key value combination. 我如何使用键值组合过滤数组。

let array is 让数组是

a=>1
a=>2
a=>3

b=>4
c=>5

is there any function to search to filter combination of key(a) and value(1) 是否有任何函数可以搜索以过滤键(a)和值(1)的组合

In php any function there. 在PHP中的任何功能。 array_map..or array_seacrh array_map ..或array_seacrh

您可以将array_filter()与array_walk()结合使用...后者确实会将键和值都传递给回调函数

Not a single function, but an array key must be unique, so you could do something like.. 不是单个函数,而是数组键必须是唯一的,因此您可以执行以下操作。

if (isset($array['a'] == 1))

... But I doubt that is way you want to know.. Could you be a bit more specific? ...但是我怀疑那是您想知道的方式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM