get_resource_id
(PHP 8)
get_resource_id — Returns an integer identifier for the given resource
Beschreibung
$resource): intThis function provides a type-safe way for generating the integer identifier for a resource.
Parameter-Liste
-
resource -
The evaluated resource handle.
Rückgabewerte
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.
Beispiele
Beispiel #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);
?>
Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:
698 698

