Re: Show only first x characters of string
| From: | Seung Hwan Kang | Date: | Wed, 30 Apr 2003 03:40:10 +0000 |
| Subject: | Re: Show only first x characters of string | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-145720@lists.php.net to get a copy of this message | ||
Mailing wrote:
Hi I am trying to find a function that only shows the first 20 characters of a string. Eg : $string = "A very long paragraph would be shown here" $dots = "..."; $str = substr($string, 0, 20);echo $str . $dots; //> echo $string $dots;
actually prints A very long paragrap... etc. Many thanks James