RE: [PHP] Display only so many characters
| From: | Jon Haworth | Date: | Tue, 05 Nov 2002 17:23:46 +0000 |
| Subject: | RE: [PHP] Display only so many characters | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-122803@lists.php.net to get a copy of this message | ||
Hi Stephen,
> I've seen this on a lot of news sites and such. How
> can I display only so many characters, then put a "..."
> to show that it's continued?
<?php
$story = "a really really really really long string";
$limit = 10; // how many chars to display
echo substr($story, 0, $limit). "...";
?>
Read all about it at http://php.net/substr
Cheers
Jon