php检索数组中的特定值

php检索数组中的特定值,php,arrays,Php,Arrays,我试图检索数组中的特定值,但它表示未定义 下面是示例数组 [customfield_10007] => Array ( [0] => com.atlassian.greenhopper.service.sprint.Sprint@13e19f2[id=70,rapidViewId=27,state=CLOSED,name=Sprint 1,goal=,startDate=2015-11-16T14:53:46.428+05:30,endDate=2015-12-11T14:53:00

我试图检索数组中的特定值,但它表示未定义

下面是示例数组

[customfield_10007] => Array ( [0] => com.atlassian.greenhopper.service.sprint.Sprint@13e19f2[id=70,rapidViewId=27,state=CLOSED,name=Sprint 1,goal=,startDate=2015-11-16T14:53:46.428+05:30,endDate=2015-12-11T14:53:00.000+05:30,completeDate=2015-12-16T11:43:21.799+05:30,sequence=70] )
我想检索state=CLOSED。你能告诉我怎样才能做到这一点吗


提前感谢,

从您的数组开始,您可以使用此片段循环它

foreach ($array as $string) {
    preg_match('/state=(\w+)/', $string[0], $matches);
    var_dump($matches);
}

应该很清楚。然后,您可以使用$matches执行所需操作。

您的
state
键是字符串的一部分,而不是数组本身。如果数组包含state=CLOSED,您可以使用
strpos
或类似函数检查数组的每个值。似乎您有一个字符串而不是数组。我猜您在解释数组时出错了,结果导致结构错误。谢谢。preg_匹配会删除特殊字符吗?你是什么意思?在$matches中,您必须使用不同的字符串,一个是completed,正如您所要求的,另一个只是说COMPLETEsometimes state=completed或state=completed\u success\u 0904。所以我想要state的值,基本上我想要state=AB Sprint 13下的所有内容,直到逗号。它可能包含空格和字母数字的特殊字符。