When I var_dump
an object, the output looks like this:
object(XCTemplate)#2477 (4) {
["id"]=>
string(1) "1"
["attributes"]=>
array(0) {
}
["db_table_name"]=>
string(14) "template_names"
["cache"]=>
array(0) {
}
}
XCTemplate
is its class, of course, but what does the integer (here: 2477) after the # mean?
It's a unique id associated with that particular instance of XCTemplate
. AFAIK this is not documented, and also there is no way to get it (other than using var_dump()
); and I've looked at the Reflection
class.
From what I've seen:
unset
) frees up its id and the next instantiated object can (and will) use it.It's not related to the variable; eg:
$foo = new Foo();
var_dump($foo);
$foo = new Foo();
var_dump($foo);
Will produce different id's for different instantiations.
This is not the same as resource ids, where you can just convert to int
to get the id:
$resource= curl_init();
var_dump($resource); // resource #1 of type curl
print(intval($resource)); // 1
print((int) $resource); // 1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With