get_resource_id

(PHP 8)

get_resource_id Returns an integer identifier for the given resource

Descrierea

get_resource_id ( resource $res ) : int

This function provides a type-safe way for generating the integer identifier for a resource.

Parametri

res

The evaluated resource handle.

Valorile întoarse

The int identifier for the given res.

This function is essentially an int cast of res to make it easier to retrieve the resource ID.

Exemple

Example #1 get_resource_id() example

<?php
$handle 
fopen('./storage/logs/lumen.log''rt');

echo (int) 
$handle "\n\n";

echo 
get_resource_id($handle);

?>

Exemplul de mai sus va afișa:

698

698

A se vedea și

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top