Dython
Dython

Reputation: 134

php retrieve specific value in a array

I am trying to retrieve the specific value in a array but it says undefined

below is the sample array

[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] )

I wanted to retrieve state=CLOSED. Could you please let me know how I can achieve this

Thanks in Advance,

Upvotes: 1

Views: 109

Answers (1)

Simone Cabrino
Simone Cabrino

Reputation: 931

Starting from your array, you can cycle it with this snippet

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

It should be clear. Then you can do what you need with $matches.

Upvotes: 1

Related Questions