Hi, I'm looking for a way to limit a string in php and add on ... at the end if the string was too long.
Thanks :)
Hi, I'm looking for a way to limit a string in php and add on ... at the end if the string was too long.
Thanks :)
You might want to take a look at this answer if you don't want to split words.
If you don't care about splitting words, then simply use the php substr function.
Do a little homework with the php online manual's string functions.
You'll want to use strlen
in a comparison setting, substr
to cut it if you need to, and the concatenation operator with "..."
or "…"