Count ViewHelper <f:count>

This ViewHelper counts elements of the specified array or countable object.

Examples

Count array elements

<f:count subject="{0:1, 1:2, 2:3, 3:4}" />
Copied!

Output:

4
Copied!

inline notation

{objects -> f:count()}
Copied!

Output:

10 (depending on the number of items in ``{objects}``)
Copied!

Source code

Go to the source code of this ViewHelper: CountViewHelper.php (GitHub).

Arguments

The following arguments are available for <f:count>:

Name Type Default
mixed
subject
Type
mixed
Required

true

Countable subject, array or Countable