php-src/Zend/tests/get_resource_id.phpt
Nikita Popov a0abc26ef7 Add get_resource_id() function
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.
2020-05-11 12:04:16 +02:00

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)