Hi internals, This originally came up in the "Stricter type-checks for arithmetic/bitwise operators" thread. I would like to add a get_resource_id() function, which does the same as an (int) $resource cast, just in a more explicit way, that does not require the reader to be familiar with PHP language minutiae. There is no plan to deprecate or remove the (int) $resource form.
This is similar to the recently added get_mangled_object_vars() function, which is (about) the same as an (array) $object cast, but makes the intention of working with mangled properties clearer clearer. The get_resource_id() name is based on the already existing get_resource_type() function. The implementation is trivial and available at https://github.com/php/php-src/pull/5427. Regards, Nikita