What is # next to object(someClass) in var_dump of an object? I have an inference. Am I right?

That number is Z_OBJ_HANDLE_PP(struc) where struc is a zval which leads to Z_OBJVAL(zval).handle which leads to (zval).value.obj.

See as well http://php.net/manual/en/internals2.variables.intro.php

In short I would say it’s the object identifier written in decimal form (ref):

php_printf("%sobject(%s)#%d (%d) {\n", COMMON, class_name, Z_OBJ_HANDLE_PP(struc), myht ? zend_hash_num_elements(myht) : 0);

And not the count of objects ever created.

Leave a Comment