Shorten long text with X amount of characters plus "..." ????

Hi guys,

Just like hhe topic says…

Let’s say I’m echoing some data that’s 30 characters long but it’s inside a table that’s 120 pixels wide and this dataid streching it either to tge sides ir upside down. It kinda hols 15 characters without affecting it’s shape. How can I make it display just 12 characters and then ad … At the end???

Thanks

use substr.
[php]
$text = “The text you get from a database or whatever”);

$text_to_print = substr($text,0, 12) . “…”;

echo $text_to_print;’
[/php]

substr: http://php.net/manual/en/function.substr.php

Sponsor our Newsletter | Privacy Policy | Terms of Service