-1

I am receiving a stdClass array from a soap server. But I don't understand how to read it.

I try it like a simple array but got this error

Cannot use object of type stdClass as array

This is the array:

object(stdClass)#2 (1) {
  ["RegistrarResult"]=>
  object(stdClass)#3 (23) {`enter code here`
    ["Anio"]=>
    NULL
    ["BancaId"]=>
    string(3) "WWW"
    ["Cedula"]=>
    string(11) "SSSS"
    ["CodigoConsorcio"]=>
    string(5) "EEEE"
    ["Color"]=>
    NULL
    ["Error"]=>
    NULL
    }
}
1
  • This is not an array, it actually is an object. All you need to do is access the object's properties. You want to read about classes and objects in php... Commented Mar 27, 2019 at 17:24

1 Answer 1

0

That is because it is an object, not an array. Use -> to access the data.

Like this

$nameOfStdClassVariable->RegistrarResult->BancaId

Should return "WWW"

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.