Skip to content

Kirby 3.9.8

size()

Determines the size/length of numbers, strings, arrays and countable objects

size(mixed $value): int

Parameters

Name Type Default
$value * mixed

Return type

int

Examples

Number of elements in array:

$array = ['a', 'b', 'c'];
dump(size($array)); // 3

Length of string:

$string = 'Kirby is great';
dump(size($string)); //15

Value of number

$number = 123456;
dump(size($number)); // number

Number of pages

$pages = $site->index();
dump(size($pages)); // number of pages in collection