get_resource_id Returns an integer identifier for the given resource

发表日期:2021-07-01 08:57:21 | 来源: | | 浏览(452) 分类:变量处理 函数

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() example

<?php 
$handle = fopen('./storage/logs/lumen.log', 'rt');
echo (int) $handle . "\n\n";
echo get_resource_id($handle);
?>

以上例程会输出:

698

698

参见

集速网 copyRight © 2015-2022 宁ICP备15000399号-1 宁公网安备 64010402001209号
与其临渊羡鱼,不如退而结网
欢迎转载、分享、引用、推荐、收藏。