Bitrix Site Manager

TruncateText

string
TruncateText(
 string text,
 int max_length
)

The function TruncateText truncates the specified string to the maximum length of max_length. If a string is truncated, ellipsis are added.

Parameters

ParameterDescription
text Source string.
max_length Maximum length of the target string.

See Also

Example



<?
$str = "1234567890";
echo TruncateText($str, 7);
// prints "1234567..."
?>