查找值是否存在于php的JSONArray中 [英] Find if value exists in a JSONArray in php
本文介绍了查找值是否存在于php的JSONArray中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个如下所示的JSONArray
I have a JSONArray as shown below
{
"output": [
"a",
"b",
"c",
"d",
"e"
]
}
我需要查找php中上述数组中是否存在"e".有人可以帮我这个忙吗?
I need to find if "e" exists in the above array in php. Can someone help me out with this ?
推荐答案
$array = json_decode($json, true);
if (in_array('e', $array['output'])) {
...
}
这篇关于查找值是否存在于php的JSONArray中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文