count

Summary

Returns the count of the input value.

Usage

$input|count(  )

Returns

Integer.

Description

This operator returns the count of the input value.
If the data is an array, the element count is returned.
If the data is an object, the object attribute count is returned.
If the data is a string, the string length is returned.
If the data is a numeric, the value itself is returned.
If the data is a boolean, false results in 0 and true results 1.
For all other data 0 is returned.

Examples

{array( 1, 2, 5 )|count}

returns 3.

Comments

log in or create a user account to comment.

Contents

Reference

Database diagram
Template operators
    PDF
    Arrays
    Data extraction
    Formatting
    Images
    Logic
    Mathematics
    Miscellaneous
    Strings
    URLs
    Variables
       float
       get_class
       get_type
       count
       int
       is_array
       is_boolean
       is_class
       is_float
       is_integer
       is_null
       is_numeric
       is_object
       is_set
       is_string
       is_unset
Template functions
Data fetching
Modules
XML tags


Created

05/02/2004
11:45:51 am
by Balazs Halasy

Last updated

11/02/2004
11:15:31 am
by Balazs Halasy

Authors

Balazs Halasy



This page is part of the Exponential documentation. The documentation is available under the GNU Free Documentation License. All contributions will be released under the terms of this license.