count_characters

Parameter PositionTypeRequiredDefaultDescription
1booleanNofalseThis 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