Truncates a string at the given length
<?php
truncate(string $value, [ int $length = 80, [ string $etc = '...', [ bool $break = false, [ bool $middle = false ]]]])
Example #1
{truncate "this text is really too long, or let's just pretend it is will you?" 30 middle=true}
{strlen truncate("this text is really too long, or let's just pretend it is will you?" 30 middle=true)} {* here we check its length to verify it's 30 chars alright *}
The above example will output:
this text is r... is will you?
30