← All built-ins / count()

count()

count(mixed $v): int

Parameters

NameTypeDescription
$varray|stringarray to count, or string to measure

Return value

Element count of the array, byte length of the string.

Example

echo count([10, 20, 30]), "
";
echo count(["a" => 1, "b" => 2]), "
";
3
2

See also

strlen()array_keys()