Alessandro Alessandro - 7 months ago 48
PHP Question

Accessing array with nested objects

I have an api wrapper i am using that returns something like this

object(stdClass)#7 (1) {
object(stdClass)#6 (2) {
string(2) "nV"
string(31) ""

how do i access the email part with PHP


Cast your API returned data to an array.

For example you are saving API returned data in $result variable. Cast it to an array.

$arrayResult = (array) $result;

echo $arrayResult[0]->email;

Try this.