get_resource_type

Supported Versions: PHP 4 >= 4.0.2, PHP 5, PHP 7, PHP 8
Returns the resource type
<?php get_resource_type(resource $resource): string
<?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     public function isGdResource()

    {

        if (is_resource($this->data)) {

            return (get_resource_type($this->data) == 'gd');

        }



        if ($this->data instanceof \GdImage) {
<?php     {

        if ($this->data instanceof StreamInterface) return true;

        if (!is_resource($this->data)) return false;

        if (get_resource_type($this->data) !== 'stream') return false;



        return true;

    }
<?php         $img->backup();

        $img->destroy();


        $this->assertEquals(get_resource_type($img->getCore()), 'Unknown');


        $this->assertEquals(get_resource_type($img->getBackup()), 'Unknown');

    }
<?php         $this->assertEquals(get_resource_type($img->getCore()), 'Unknown');


        $this->assertEquals(get_resource_type($img->getBackup()), 'Unknown');

    }



    public function testStringConversion()
<?php             throw new InvalidStreamProvided(

                "Invalid stream provided, expected stream resource, received " . gettype($contents)

            );

        } elseif ($type = get_resource_type($contents) !== 'stream') {

            throw new InvalidStreamProvided(

                "Invalid stream provided, expected stream resource, received resource of type " . $type

            );
<?php             case 'resource (closed)':

                $this->type = self::TYPE_RESOURCE;

                $this->handle = (int) $value;

                if ('Unknown' === $this->class = @get_resource_type($value)) {

                    $this->class = 'Closed';

                }

                $this->cut = -1;
<?php                         if (empty($resRefs[$h = (int) $v])) {

                            $stub = new Stub();

                            $stub->type = Stub::TYPE_RESOURCE;

                            if ('Unknown' === $stub->class = @get_resource_type($v)) {

                                $stub->class = 'Closed';

                            }

                            $stub->value = $v;
<?php     private function hasColorSupport($stream): bool

    {

        if (!\is_resource($stream) || 'stream' !== get_resource_type($stream)) {

            return false;

        }