-1

Can you help to iterate this stdClass with a loop? I want to print just the values.

stdClass Object ( [GetInfoResult] => stdClass Object ( [string] => Array ( [0] => My Value 1 [1] => My Value 2 [2] => My Value 3 [3] => My Value 4 [4] => My val 5 [5] => My val 6 [6] => My last val ) ) ) 

Example:

  • My Value 1
  • My Value 2
  • My Value 3
  • ... etc

1 Answers1

0

The values you want to print are in an array that's nested in the object. Just access the array and use foreach.

foreach ($object->GetInfoResult->string as $string) {
    echo $string;
}
Barmar
  • 741,623
  • 53
  • 500
  • 612