使用in数组访问对象

时间:2013-07-04 10:22:29

标签: php arrays

Array
(
[0] => Contact Object
    (
[id] => 1
[status] => ACTIVE
[first_name] => Ahmed
[middle_name] => 
[last_name] => Taibah
[confirmed] => 
[source] => 
[email_addresses] => Array
(
[0] => EmailAddress Object
(
[id] => 1
[status] => ACTIVE
[confirm_status] => NO_CONFIRMATION_REQUIRED
[opt_in_source] => ACTION_BY_OWNER
[opt_in_date] => 2009-07-23T05:54:30.315Z
[opt_out_date] => 
[email_address] => info@test.sa
)
)

我如何得到[confirm_status]的值,因为这是在对象然后数组然后再次对象然后我需要这个索引值。

3 个答案:

答案 0 :(得分:5)

$arr[0]->email_addresses[0]->confirm_status

答案 1 :(得分:1)

$contact[0]->email_addresses[0]->confirm_status

你可以这样做。

答案 2 :(得分:0)

你可以像

一样使用它
$confirm_status = $arr['email_addresses'][0]->confirm_status;