RE: [PHP] limiting characters
| From: | Dennis Cole | Date: | Wed, 18 Apr 2001 22:48:57 +0000 |
| Subject: | RE: [PHP] limiting characters | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-136084@lists.php.net to get a copy of this message | ||
$words = "All I want for Christmas is my two front teeth ";
$newwords = trim($words);
$pieces = explode(" ", $words);
echo "$pieces[0] $pieces[1] $pieces[2] $pieces[3]...";
// Retures "All I want for... "
-----Original Message-----
From: Michael P. Carel [mailto:mikecarel@teamglac.com]
Sent: Tuesday, February 18, 2003 6:19 PM
To: Justin French; php-general@lists.php.net
Subject: Re: [PHP] limiting characters
it would be better if it will be chopped by words and not by characters. Any
idea how?
----- Original Message -----
From: "Justin French" <justin@indent.com.au>
To: "Michael P. Carel" <mikecarel@teamglac.com>; <php-general@lists.php.net>
Sent: Wednesday, February 19, 2003 7:26 AM
Subject: Re: [PHP] limiting characters
> Do you want it chopped at a certain number of words, or characters?
>
> Justin French
>
>
>
> on 19/02/03 10:00 AM, Michael P. Carel (mikecarel@teamglac.com) wrote:
>
> > Hi to all,
> >
> > How could i limit the character output that is being displayed in the
html
> > page. Is there a function or a php classes that perfectly support it?
> >
> > Example:
> >
> > $myoutput = "This is my sample output.";
> >
> > Required Output:
> >
> > This is my ....
> >
> > Any idea? Thanks in advance for the replies
> >
> >
> >
> > mike
> >
> >
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php