0

Ok I did some searching and everything I saw involved loops, but I don't think it would really require on. I'm trying to get the 'href' value which appears to be within an array in the initial array:

Trying to access data in an array that has an embedded array how do I get [actions][href] ?:

["domains"]=>
  array(1) {
    [0]=>
    array(5) {
      ["resource"]=>
      string(96) "xxxx"
      ["name"]=>
      string(34) "yyyy"
      ["type"]=>
      string(9) "Blacklist"
      ["count"]=>
      int(2672)
      ["actions"]=>
      array(1) {
        [0]=>
        array(1) {
          ["download"]=>
          array(2) {
            ["href"]=>
            string(105) "WANT THIS VALUE"
            ["method"]=>
            string(3) "GET"
Dan
  • 17
  • 5
  • 2
    `$foo['domains'][0]['actions'][0]['download']['href']` should do it ... just following "down the chain" (of keys), really ... – CBroe Jun 07 '17 at 21:56
  • Thank you! I had felt dumb asking..... but saved me pulling my hair out, much appreciated CBroe! – Dan Jun 07 '17 at 22:04
  • @Dan Since it contains arrays, that suggests that there could be multiple elements. You might need to loop through them to find the one that you want, instead of using `[0]` all the time. – Barmar Jun 07 '17 at 22:07
  • 1
    Possible duplicate of [How can I access an array/object?](https://stackoverflow.com/questions/30680938/how-can-i-access-an-array-object) – mickmackusa Jun 07 '17 at 22:53

0 Answers0