使用stdClass Object从PHP foreach数组中检索值

时间:2013-12-28 12:31:59

标签: php arrays object multidimensional-array

Array (
      [0] => stdClass Object
                             (
                               [object_id] => 109957
                              )
      [1] => stdClass Object 
                              (
                                [object_id] => 109834
                               )
      [2] => stdClass Object
                              ( 
                                [object_id] => 109952 
                              )
      [3] => stdClass Object
                            ( 
                              [object_id] => 109964
                                )

 )

1 个答案:

答案 0 :(得分:1)

foreach($some_array as $key => $row) {
  $row->object_id; // Get object id
}