jclaveau /
php-chainable-array
| 1 | <?php |
||
| 2 | if (!function_exists('spl_object_id')) { |
||
| 3 | /** |
||
| 4 | * @see https://secure.php.net/manual/en/function.spl-object-id.php |
||
| 5 | * This method doesn't exist before PHP 7.2.0 |
||
| 6 | */ |
||
| 7 | function spl_object_id($object) |
||
| 8 | { |
||
| 9 | ob_start(); |
||
| 10 | var_dump($object); // object(foo)#INSTANCE_ID (0) { } |
||
|
0 ignored issues
–
show
Security
Debugging Code
introduced
by
Loading history...
|
|||
| 11 | return preg_replace('~.+#(\d+).+~s', '$1', ob_get_clean()); |
||
| 12 | } |
||
| 13 | } |
||
| 14 | |||
| 15 | if (!function_exists('is_iterable')) { |
||
| 16 | /** |
||
| 17 | * @see https://github.com/symfony/polyfill-php71/commit/36004d119352f4506398032259a08e4ca9607285 |
||
| 18 | * This method doesn't exist before PHP 7.1.0 |
||
| 19 | */ |
||
| 20 | function is_iterable($object) |
||
| 21 | { |
||
| 22 | return is_array($object) || $object instanceof \Traversable; |
||
| 23 | } |
||
| 24 | } |
||
| 25 |