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.

Detecting whether a PHP variable is a reference / referenced

Full working example: function EqualReferences(&$first, &$second){ if($first !== $second){ return false; } $value_of_first = $first; $first = ($first === true) ? false : true; // modify $first $is_ref = ($first === $second); // after modifying $first, $second will not be equal to $first, unless $second and $first points to the same variable. $first = $value_of_first; … Read more