Search code examples
phpxdebugvar-dump

xDebug: What's the number included in var_dump?


If you're using xDebug with PHP and var_dump an object, you'll see output something like this

object(Example)[176]

That is, var_dump will show you the variable is an object, that its class is Example, and -- then there's the number. In the above example, this number is 176. What is this number? Memory usage? Internal reference count? Something else? A cursory look at the documentation and Google hasn't turned anything up.


Solution

  • That number is an internal object handle (it's actually a global instance counter, but that's an implementation detail).

    Its purpose is to enable the developer to "visually" compare objects for identity; two objects compare equal with === if and only if that number is the same on the var_dump printout of both.