Str::short()
Shortens a string and adds an ellipsis if the string is too long
Str::short(string $string, int $length = 0, string $appendix = '…'): string
Parameters
Name | Type | Default | Description |
---|---|---|---|
$stringrequired | string |
no default value | The string to be shortened |
$length | int |
0
|
The final number of characters the string should have |
$appendix | string |
'…'
|
The element, which should be added if the string is too long. Ellipsis is the default. |
Return type
string
The shortened string
Parent class
Examples
echo Str::short('This is a very, very, very long string', 10);
// output: This is a…