is_resource()
and get_resource_type()
that can understand objects that replaced earlier resources.
composer require arokettu/is-resource
<?php
use Arokettu\IsResource as r;
$hash = hash_init('md5');
// vanilla functions:
is_resource($hash); // true in PHP <= 7.1, false in PHP >= 7.2
get_resource_type($hash); // "Hash Context" in PHP <= 7.1, null or TypeError in PHP >= 7.2
// library functions:
r\is_resource($hash); // true
r\get_resource_type($hash); // "Hash Context"
Read full documentation here: https://sandfox.dev/php/is-resource.html
Also on Read the Docs: https://is-resource.readthedocs.io/
Please file issues on our main repo at GitLab: https://gitlab.com/sandfox/is-resource/-/issues
Feel free to ask any questions in our room on Gitter: https://gitter.im/arokettu/community
The library is available as open source under the terms of the MIT License.