3

I tried to var_dump a Zend_Controller_Request_Http object in Zend framework.

The output is below:

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)

I noticed at the first line, there's a [14], what's the meaning of that number?

I looked up it in the PHP manual but didn't find any explanation.

David Ferenczy Rogožan
  • 23,966
  • 9
  • 79
  • 68
roast_soul
  • 3,554
  • 7
  • 36
  • 73
  • 1
    That's not quite the typical format of `var_dump`. Which version of PHP do you have, do you have xDebug installed? My best guess would be "the number of properties in this object", but that's off by one. – DCoder Sep 07 '13 at 05:44
  • PHP version 5.4.7.Yes, I have the Xdebug – roast_soul Sep 07 '13 at 05:49
  • 2
    it is some kind of internal object id i guess. try creating 3 objects in a row and vard_dump them after, you will notice that 'strange number' is incrementing for each object. – Vitaly Muminov Sep 07 '13 at 05:53
  • The default `var_dump` prints both an internal object ID and the number of properties in the first line, but I can't get the output in the format you got. – DCoder Sep 07 '13 at 05:57
  • @Vitaly Muminov Yes, I see it.I think this is reasonable. – roast_soul Sep 07 '13 at 06:00

1 Answers1

0

No, it's not "the number of properties in this object"

I tried below code:

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

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

the output is :

object(testc)[1]
  protected 'a' => null
  protected 'b' => null
  private 'c' => null
  private 'd' => null
  public 'e' => null
  public 'f' => null
roast_soul
  • 3,554
  • 7
  • 36
  • 73