Skip to content
Advertisement

Short Text, PHP

I got this function:

JavaScript

and if I use echo shorter($input, 11) it works ok, but if there are some white spaces in the input, otherwise for the input looking like:

wwwwwwwwwww

The function will change this into:

… (3 dots).

I wan’t it to be changed into something like this:

www …

Have you got any ideas how to rebuild this script? Thank you in advance.

Advertisement

Answer

Im assuming you just want to take an input. If it is longer than X then cut it off at X and add “…”.

JavaScript

I didn’t test this, but it should work. 🙂

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement