我正在尝试根据键数组(查询参数)来整理多维数组,但这样做没有运气。
来自数据库的数组:
AOD (Array, 2 elements)
topic (String, 21 characters ) Alcohol & Other Drugs
lessons (Array, 29 elements)
CEH (Array, 2 elements)
topic (String, 25 characters ) Community & Environmental
lessons (Array, 23 elements)
键数组(查询字符串):
0 (String, 3 characters ) AOD
1 (String, 3 characters ) CEH
所以,如果我只传入AOD
,那么上面的第一个数组只会返回多维数组AOD
代码:
array_intersect($snsData, array_flip($query_topics))