Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Counts all elements in an array or in a Countable object
Alias sizeof
<?php count(Countable|array $value, int $mode = COUNT_NORMAL): int
<?php     protected function shouldGenerate(array $types, array $only, array $skip): bool

    {

        if (count($only)) {

            return collect($types)->intersect($only)->isNotEmpty();

        }
<?php             return collect($types)->intersect($only)->isNotEmpty();

        }



        if (count($skip)) {

            return collect($types)->intersect($skip)->isEmpty();

        }
<?php         if (empty($definitions)) {

            $this->error('No models found');

        } else {

            $this->info('Traced ' . count($definitions) . ' ' . Str::plural('model', count($definitions)));

        }



        return 0;
<?php         foreach ($model->indexes() as $index) {

            $index_definition = self::INDENT;

            $index_definition .= '$table->' . $index->type();

            if (count($index->columns()) > 1) {

                $index_definition .= "(['" . implode("', '", $index->columns()) . "']);" . PHP_EOL;

            } else {

                $index_definition .= "('{$index->columns()[0]}');" . PHP_EOL;
<?php         }



        $resource_methods = array_intersect($methods, Controller::$resourceMethods);

        if (count($resource_methods)) {

            $routes .= $controller->isApiResource()

                ? sprintf("Route::apiResource('%s', %s)", $slug, $className)

                : sprintf("Route::resource('%s', %s)", $slug, $className);
<?php                 ? array_diff(Controller::$apiResourceMethods, $resource_methods)

                : array_diff(Controller::$resourceMethods, $resource_methods);



            if (count($missing_methods)) {

                if (count($missing_methods) < 4) {

                    $routes .= sprintf("->except('%s')", implode("', '", $missing_methods));

                } else {
<?php                 : array_diff(Controller::$resourceMethods, $resource_methods);



            if (count($missing_methods)) {

                if (count($missing_methods) < 4) {

                    $routes .= sprintf("->except('%s')", implode("', '", $missing_methods));

                } else {

                    $routes .= sprintf("->only('%s')", implode("', '", $resource_methods));
<?php         $matches = array_filter(array_keys($this->models), fn ($key) => Str::endsWith(Str::afterLast(Str::afterLast($key, '\\'), '/'), [Str::studly($context), Str::studly(Str::plural($context))]));



        if (count($matches) === 1) {

            return $this->models[current($matches)];

        }

    }
<?php         $matches = array_filter(array_keys($this->models), fn ($key) => Str::endsWith($key, '\\' . Str::studly($context)));



        if (count($matches) === 1) {

            return $this->models[current($matches)]->fullyQualifiedClassName();

        }