PHP中var_dump输出后的方括号

时间:2013-09-07 05:29:47

标签: php var-dump

我在Zend框架中尝试var_dump Zend_Controller_Request_Http个对象。

输出如下:

object(Zend_Controller_Request_Http)[14]
  protected '_paramSources' => 
    array (size=2)
      0 => string '_GET' (length=4)
      1 => string '_POST' (length=5)
  protected '_requestUri' => string '/' (length=1)
  protected '_baseUrl' => string '' (length=0)
  protected '_basePath' => null
  protected '_pathInfo' => string '/' (length=1)
  protected '_params' => 
    array (size=3)
      'controller' => string 'index' (length=5)
      'action' => string 'index' (length=5)
      'module' => string 'default' (length=7)
  protected '_rawBody' => null
  protected '_aliases' => 
    array (size=0)
      empty
  protected '_dispatched' => boolean true
  protected '_module' => string 'default' (length=7)
  protected '_moduleKey' => string 'module' (length=6)
  protected '_controller' => string 'index' (length=5)
  protected '_controllerKey' => string 'controller' (length=10)
  protected '_action' => string 'index' (length=5)
  protected '_actionKey' => string 'action' (length=6)

我注意到第一行有一个[14],这个数字是什么意思?

我在PHP手册中查了一下,但没有找到任何解释。

1 个答案:

答案 0 :(得分:1)

不,这不是“此对象中的属性数量”

我尝试了以下代码:

class testc
{
    protected $a;
    protected $b;
    private $c;
    private $d;
    public $e;
    public $f;
}

$a=new testc();
var_dump($a);

输出是:

object(testc)[1]
  protected 'a' => null
  protected 'b' => null
  private 'c' => null
  private 'd' => null
  public 'e' => null
  public 'f' => null