开发者

getting values of inner objects with php

开发者 https://www.devze.com 2023-03-30 05:09 出处:网络
I think this is a basic question, but I just can\'t get it right and its really crazy... i tried turning it into an array and many other things, but I just don\'t get it right.

I think this is a basic question, but I just can't get it right and its really crazy... i tried turning it into an array and many other things, but I just don't get it right. How can I access the value in the Country index with PHP? I tried so many ways and just can't get directly to it. this is the object:`

 [type] => Contact
[fields] => stdClass Object
    (
        [FirstName] => my
        [LastName] => name
        [0] => SObject Object
            (
                [type] => Account
                [fields] => stdClass Object
                    (
                        [Country] => Netherlands
                    )

            )

    )

)

I tried accessing the [0] as an array (object returns error) but still nothing. thanks, and sorry if its a silly question - i have to say here was quite a research effort but开发者_StackOverflow社区 for no avail...


Cast your object to array with

$array = (array)$object;
$inner_obj = $array[0];
0

精彩评论

暂无评论...
验证码 换一张
取 消