时间:2021-07-01 10:21:17 帮助过:6人阅读
你这个描述不对吧,,如果等于2,时等于3时呢?
没想到什么好办法,只能根据a的值去查相应元素的各自位置,再用这些位置去b,c里去取值
为何不这样:
$abc = array(array(1,'a','b'),array(1,'a','b'),)
或者存成文件模拟数据库。然后自定义search函数
$array_a = explode(',', '1,1,1,2,2,2,3,3,3,4,4,4,5,5,5');$array_b = explode(',', 'a,a,a,a,a,b,b,b,b,c,c,c,s,s,s');$array_c = explode(',', 'b,b,c,d,d,s,a,s,d,s,a,d,a,d,d');$res_a = array_keys($array_a, 1);$res_b = array_intersect_key($array_b, array_flip($res_a));$res_c = array_intersect_key($array_c, array_flip($res_a));print_r($res_b);print_r($res_c);Array
$array_a = explode(',', '1,1,1,2,2,2,3,3,3,4,4,4,5,5,5');$array_b = explode(',', 'a,a,a,a,a,b,b,b,b,c,c,c,s,s,s');$array_c = explode(',', 'b,b,c,d,d,s,a,s,d,s,a,d,a,d,d');$res_a = array_keys($array_a, 1);$res_b = array_intersect_key($array_b, array_flip($res_a));$res_c = array_intersect_key($array_c, array_flip($res_a));print_r($res_b);print_r($res_c);Array