is_resource

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Finds whether a variable is a resource
<?php is_resource(mixed $value): bool
<?php                 $value,

                match (true) {

                    is_int($value) => PDO::PARAM_INT,

                    is_resource($value) => PDO::PARAM_LOB,

                    default => PDO::PARAM_STR

                },

            );
<?php                 return true;

            }



            is_resource($contents)

                ? $this->driver->writeStream($path, $contents, $options)

                : $this->driver->write($path, $contents, $options);

        } catch (UnableToWriteFile|UnableToSetVisibility $e) {
<?php             $path = trim($path.'/'.$name, '/'), $stream, $options

        );



        if (is_resource($stream)) {

            fclose($stream);

        }
<?php     assert(isset($getopt['status-file']) && is_string($getopt['status-file']));

    $statusFile = fopen($getopt['status-file'], 'wb');

    assert(is_resource($statusFile));



    assert(isset($getopt['progress-file']) && is_string($getopt['progress-file']));

    assert(isset($getopt['unexpected-output-file']) && is_string($getopt['unexpected-output-file']));
<?php         }



        foreach ($this->lobs as [$source, $target]) {

            if (is_resource($source)) {

                $this->copyStreamToStream($source, $target);



                continue;
<?php             }



            if ($types[$parameter - 1] === static::$_paramTypeMap[ParameterType::LARGE_OBJECT]) {

                if (is_resource($value)) {

                    if (get_resource_type($value) !== 'stream') {

                        throw NonStreamResourceUsedAsLargeObject::new($parameter);

                    }
<?php         $parser->parse($query, $visitor);



        $stmt = oci_parse($dbh, $visitor->getSQL());

        assert(is_resource($stmt));



        $this->_sth          = $stmt;

        $this->_dbh          = $dbh;
<?php             return null;

        }



        $value = is_resource($value) ? stream_get_contents($value) : $value;



        set_error_handler(function (int $code, string $message): bool {

            throw ConversionException::conversionFailedUnserialization($this->getName(), $message);
<?php         if (is_string($value)) {

            $fp = fopen('php://temp', 'rb+');

            assert(is_resource($fp));

            fwrite($fp, $value);

            fseek($fp, 0);

            $value = $fp;
<?php             $value = $fp;

        }



        if (! is_resource($value)) {

            throw ConversionException::conversionFailed($value, Types::BINARY);

        }
<?php         if (is_string($value)) {

            $fp = fopen('php://temp', 'rb+');

            assert(is_resource($fp));

            fwrite($fp, $value);

            fseek($fp, 0);

            $value = $fp;
<?php             $value = $fp;

        }



        if (! is_resource($value)) {

            throw ConversionException::conversionFailed($value, Types::BLOB);

        }
<?php             return null;

        }



        if (is_resource($value)) {

            $value = stream_get_contents($value);

        }
<?php             return null;

        }



        $value = is_resource($value) ? stream_get_contents($value) : $value;



        set_error_handler(function (int $code, string $message): bool {

            throw ConversionException::conversionFailedUnserialization($this->getName(), $message);
<?php             return [];

        }



        $value = is_resource($value) ? stream_get_contents($value) : $value;



        return explode(',', $value);

    }