RE: [PHP] Show only first x characters of string
| From: | Ross Bateman | Date: | Tue, 29 Apr 2003 13:57:15 +0000 |
| Subject: | RE: [PHP] Show only first x characters of string | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-145651@lists.php.net to get a copy of this message | ||
Hi
Try
string substr ( string string, int start [, int length])
substr() returns the portion of string specified by the start and length
parameters.
Hope that helps,
Ross
-----Original Message-----
From: mailing [mailto:mailing@jduncan.co.uk]
Sent: 29 April 2003 03:48
To: php-general@lists.php.net
Subject: [PHP] Show only first x characters of string
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 = "...";
echo $string $dots;
actually prints
A very long paragrap...
etc.
Many thanks
James
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php