Robert Morel Robert Morel - 18 days ago 4x
PHP Question

Access a Multiple level stdClass object field?

I have received this ridiculously complex array of objects as a SOAP response. I need to print out the "string_operator_collection" using a loop. It is a collection of operators similiar to ["equal_wild"] but with all different names. The nesting is so deep that I can't seem to access using normal methods. Any ideas please?

object(stdClass)#2 (1) {
=> object(stdClass)#3 (2) {
["response_context"]=> object(stdClass)#4 (3) {
=> string(28) "b0ac045931183d1ead6b9f6da061"
["response_status"]=> string(2) "OK"
["response_message"]=> string(0) "" }
=> object(stdClass)#5 (2) {
["search_field_collection"]=> object(stdClass)#6 (1) {
["search_field"]=> array(4) {
[0]=> object(stdClass)#7 (3) {
=> string(82)
["field_name"]=> string(15) "Customer Number"
=> object(stdClass)#8 (1) {
=> object(stdClass)#9 (16) {
["equal_wild"]=> string(2) "=*"

My best effort so far is:




I think (display is not helpful) the address of string_operator_collection is


So as the array starts at


we can write a loop like this

$the_array =  $obj

foreach($the_array as $field ) {
    echo $field