Dutch PHP Conference 2025 - Call For Papers

get_resource_id

(PHP 8)

get_resource_id Returns an integer identifier for the given resource

Опис

get_resource_id(resource $resource): int

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.

Приклади

Приклад #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);

?>

Поданий вище приклад виведе щось схоже на:

698
698

Прогляньте також

add a note

User Contributed Notes

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