Php 访问数组内对象内的字符串

Php 访问数组内对象内的字符串,php,arrays,wordpress,object,chaining,Php,Arrays,Wordpress,Object,Chaining,在wordpress中,我有如下数据结构: array 49 => object(stdClass)[272] public 'ID' => int 49 ... // I need this guid public 'guid' => string 'http://localhost/github/wordpress/wp-content/uploads/2012/09/3.png' (length=66)

在wordpress中,我有如下数据结构:

array
  49 => 
    object(stdClass)[272]
      public 'ID' => int 49
      ...
      // I need this guid
      public 'guid' => string 'http://localhost/github/wordpress/wp-content/uploads/2012/09/3.png' (length=66)
      ...
  47 => 
    object(stdClass)[275]

  46 => 
    object(stdClass)[276]
      public 'ID' => int 46
      ...
      public 'filter' => string 'raw' (length=3)
我正在尝试访问
guid
,此操作有效:

$temp121212 = get_children($post->ID);
echo $temp121212[49]->guid;
但这并不是:

echo get_children($post->ID)[49]->guid;

我做错了什么?不能这样做吗?

在PHP5.3之前,您不能(例如在javascript中),这就是所谓的数组解引用

因此,您必须将阵列存储在某个位置:

$child = get_children($post->ID)[49];
echo $child -> guid;
然而,在PHP5.4中,您可以使用自己的语法