Smarty Manual
Prev | Chapter 5. Variable Modifiers | Next

# count_characters

Parameter Position | Type | Required | Default | Description
--- | --- | --- | --- | ---
1 | boolean | No | false | This determines whether or not to include whitespace characters in the count.

This is used to count the number of characters in a variable.

Example 5-3. count_characters
`<?php $smarty = new Smarty; $smarty->assign('articleTitle', 'Cold Wave Linked to Temperatures.'); $smarty->display('index.tpl'); ?>`
Where index.tpl is:
    {$articleTitle}
    {$articleTitle|count_characters}
    {$articleTitle|count_characters:true}
This will output:
    Cold Wave Linked to Temperatures.
    29
    33

Prev | Home | Next
Variable Modifiers | Up | cat