I'm looking for a way to get the instance ID of a given object / resource with PHP, the same way var_dump() does:
var_dump(curl_init()); // resource #1 of type curl
var_dump(curl_init()); // resource #2 of type curl
How can I get the instance count without calling var_dump()? Is it possible?
Convert resource to id with
sprintf()
Convert it to an int to get the resource ID:
This is a very interesting question... I would be interested to see what you would use this for... but here is one way...