is_countable
laravel/framework
Supported Versions: PHP 7 >= 7.3.0, PHP 8
Verify that the contents of a variable is a countable value
is_countable
(
mixed $value
):
bool
public static function
plural
(
$value
,
$count
=
2
)
{
if (
is_countable
(
$count
)) {
$count
=
count
(
$count
);
}
src/Illuminate/Support/Pluralizer.php
if (
is_countable
(
$number
)) {
$number
=
count
(
$number
);
}
src/Illuminate/Translation/Translator.php
return
false
;
} elseif (
is_string
(
$value
) &&
trim
(
$value
) ===
''
) {
return
false
;
} elseif (
is_countable
(
$value
) &&
count
(
$value
) <
1
) {
return
false
;
} elseif (
$value
instanceof
File
) {
return (string)
$value
->
getPath
() !==
''
;
src/Illuminate/Validation/Concerns/ValidatesAttributes.php
public function
addLoop
(
$data
)
{
$length
=
is_countable
(
$data
) && !
$data
instanceof
LazyCollection
?
count
(
$data
)
:
null
;
src/Illuminate/View/Concerns/ManagesLoops.php