0

The [1152] key is dynamic.

I need to access the child keys (ex: guid) but the parent key [1152] is dynamic and there is no way for me to know which number is going to be generated.

Is it possible to access [guid] without knowing what the number is in the parent key?

enter image description here

Marcos Vinicius
  • 207
  • 3
  • 14

1 Answers1

2

Yes process the first level of the array in a simple foreach and then the inner array specifically like this

foreach ($array as $dynamic) {
    foreach ($dynamic as $key=>$val) {

        echo $key . ' = ' . $val;
    }
}

Or even more simply

foreach ($array as $dynamic) {
    echo $dyanmic['guid'];
}
RiggsFolly
  • 93,638
  • 21
  • 103
  • 149