array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'de', ), 'this' => array ( 0 => 'function.get-resource-id.php', 1 => 'get_resource_id', ), 'up' => array ( 0 => 'ref.var.php', 1 => 'Funktionen zur Behandlung von Variablen', ), 'prev' => array ( 0 => 'function.get-defined-vars.php', 1 => 'get_defined_vars', ), 'next' => array ( 0 => 'function.get-resource-type.php', 1 => 'get_resource_type', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/var/functions/get-resource-id.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 8)
get_resource_id — Returns an integer identifier for the given resource
This function provides a type-safe way for generating the integer identifier for a resource.
resource
The evaluated resource handle.
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.
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