Are PHP resource IDs unique per PHP instance? Does casting all kinds of resources to string returns "Resource id #X" (where X
is some decimal number)? Is there a function that returns resource ID (I know about get_resource_type()
to get resource typem, but didn't find anything like get_resouce_id()
), or does it have to be done like this?
function get_resource_id($resource)
{
return is_resource($resouce)
? substr((string) $resource, 13 /* strlen("Resource id #") */)
: NULL;
}
Easy as it seams
intval($resource)
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