mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
a0abc26ef7
Behavior is same as for (int) $resource, just under a clearer name. Also type-safe, in that the parameter actually needs to be a resource. Closes GH-5427.
19 lines
328 B
PHP
19 lines
328 B
PHP
--TEST--
|
|
get_resource_id() function
|
|
--FILE--
|
|
<?php
|
|
|
|
$file = fopen(__FILE__, 'r');
|
|
|
|
// get_resource_id() is equivalent to an integer cast.
|
|
var_dump(get_resource_id($file) === (int) $file);
|
|
|
|
// Also works with closed resources.
|
|
fclose($file);
|
|
var_dump(get_resource_id($file) === (int) $file);
|
|
|
|
?>
|
|
--EXPECT--
|
|
bool(true)
|
|
bool(true)
|