PHP: get_resource_id - Manual
(PHP 8)
get_resource_id โ Returns an integer identifier for the given resource
Parameters
resource-
The evaluated resource handle.
Return Values
The int identifier for the given resource.
This function is essentially an int cast of
resource to make it easier to retrieve the resource ID.
Examples
Example #1 get_resource_id() produces the same result as an int cast
<?php
$handle = fopen("php://stdout", "w");
echo (int) $handle . "\n";
echo get_resource_id($handle);
?>The above example will output something similar to: