Jakub, yes PHP will always provide you with a unique identifier for each resource that is currently in use. When a resource is disabled () or free, for example mysql_free_result . This identifier is then available again, and PHP can reuse these resources.
Be careful if you "cache" or save the resource identifier in the session and reuse them, because PHP can free the resource and then recreate a new resource with this identifier, and your old resource identifier may point to something new.
So, you have it, the resources are unique, but not forever!
We hope this helps demystify the resource types in PHP for you.
source share