Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Get the type of a variable
gettype(mixed $value): string
            if (! is_array($result)) {

                throw new 
UnexpectedValueException(sprintf(

                    
"%s::reduceSpread expects reducer to return an array, but got a '%s' instead.",

                    
class_basename(static::class), gettype($result)

                ));

            }

        }
        }



        
PHPUnit::assertContains(

            
strtolower(gettype($actual)),

            
$expected,

            
sprintf('Property [%s] is not of expected type [%s].'$this->dotPath($key), implode('|'$expected))

        );
    protected function isSameType($first$second)

    {

        return 
gettype($first) == gettype($second);

    }
        $changes $user->articles()->sync($articleIDs);



        
collect($changes['attached'])->map(function ($id) {

            
$this->assertSame(gettype($id), (new BelongsToManySyncTestTestArticle)->getKeyType());

        });



        
$user->articles->each(function (BelongsToManySyncTestTestArticle $article) {
        $changes $user->articles()->syncWithPivotValues($articleIDs, ['visible' => true]);



        
collect($changes['attached'])->each(function ($id) {

            
$this->assertSame(gettype($id), (new BelongsToManySyncTestTestArticle)->getKeyType());

        });



        
$user->articles->each(function (BelongsToManySyncTestTestArticle $article) {
        foreach ([11.1'phpinfo', new stdClass] as $condition) {

            try {

                new 
ExcludeIf($condition);

                
$this->fail('The ExcludeIf constructor must not accept '.gettype($condition));

            } catch (
InvalidArgumentException $exception) {

                
$this->assertEquals('The provided condition must be a callable or boolean.'$exception->getMessage());

            }
        foreach ([11.1'phpinfo', new stdClass] as $condition) {

            try {

                
$rule = new ProhibitedIf($condition);

                
$this->fail('The ProhibitedIf constructor must not accept '.gettype($condition));

            } catch (
InvalidArgumentException $exception) {

                
$this->assertEquals('The provided condition must be a callable or boolean.'$exception->getMessage());

            }