Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Counts all elements in an array or in a Countable object
<?php count(Countable|array $value, int $mode = COUNT_NORMAL): int
<?php protected function makeTopLevel()
{
if (count(config('statamic.cp.widgets')) > 0 || config('statamic.cp.start_page') === 'dashboard') {
Nav::topLevel('Dashboard')
->route('dashboard')
->icon('charts');
<?php return Nav::item($utility->navTitle())->url($utility->url());
});
if (count($utilities)) {
Nav::tools('Utilities')
->route('utilities.index')
->icon('settings-slider')
<?php $args = $args[0];
}
if (! is_array($args) || ! count($args)) {
return null;
}
<?php return $blueprints->map(function ($blueprint) use ($collection, $collections, $blueprints) {
return [
'title' => $this->getCreatableTitle($collection, $blueprint, count($collections), $blueprints->count()),
'url' => $collection->createEntryUrl(Site::selected()->handle()).'?blueprint='.$blueprint->handle(),
];
});
<?php {
public function passes($attribute, $value)
{
return collect($value)->map->origin->filter()->count() !== count($value);
}
public function message()
<?php public function usingSingleTaxonomy()
{
return count($this->taxonomies()) === 1;
}
protected function createTermFromString($string, $taxonomy)
<?php public function preProcess($data)
{
if (is_array($data)) {
return count($data) > 0 ? \Statamic\Facades\Yaml::dump($data) : '';
}
return $data;
<?php $sites = config('statamic.sites.sites');
throw_if(count($sites) > 1, new StatamicProRequiredException('Statamic Pro is required to use multiple sites.'));
return $next($request);
}
<?php public function count($value, $params)
{
return count($value);
}
<?php if (count($params) > 1) {
$params = [implode('|', $params)];
}
<?php $needle = Arr::get($context, $params[0], $params);
if (is_array($needle) && count($needle) === 1) {
$needle = $needle[0];
}
<?php $value = $value->toArray();
}
return (is_array($value)) ? count($value) : Stringy::length($value);
}
<?php return $value;
}
if (count($params) > 1) {
$params = [implode('|', $params)];
}
<?php $words = empty($string = trim($value)) ? [] : preg_split('~[^\p{L}\p{N}\']+~u', $value);
return count($words);
}
<?php public function visibleTo($key)
{
return $key === 'entries-fieldtype' && count($this->context['collections']) > 1;
}
protected function options()