PHP Classes

File: htdocs/xoops_lib/vendor/smarty/smarty/docs/designers/language-modifiers/language-modifier-count.md

Recommend this page to a friend!
  Packages of Michael Beck   Xoops 2.5   htdocs/xoops_lib/vendor/smarty/smarty/docs/designers/language-modifiers/language-modifier-count.md   Download  
File: htdocs/xoops_lib/vendor/smarty/smarty/docs/designers/language-modifiers/language-modifier-count.md
Role: Auxiliary data
Content type: text/markdown
Description: Auxiliary data
Class: Xoops 2.5
Modular content management publication system
Author: By
Last change:
Date: 2 months ago
Size: 711 bytes
 

Contents

Class file image Download

count

Returns the number of elements in an array (or Countable object). Will return 0 for null. Returns 1 for any other type (such as a string).

If the optional mode parameter is set to 1, count() will recursively count the array. This is particularly useful for counting all the elements of a multidimensional array.

Basic usage

{if $myVar|count > 3}4 or more{/if}
{if count($myVar) > 3}4 or more{/if}

Parameters

| Parameter | Type | Required | Description | |-----------|------|----------|--------------------------------------------------------| | 1 | int | No | If set to 1, count() will recursively count the array. |