You are here: Re: [PHP] displaying certain number of character « PHP « IT news, forums, messages
Re: [PHP] displaying certain number of character

Posted by Philip Hallstrom on 10/08/77 11:25

> $words= "If length is given and is negative,
> then that many characters will be omitted from
> the end of string (after the start position has
> been calculated when a start is negative). If start
> denotes a position beyond this truncation, an empty
> string will be returned. ";
>
> echo substr($words, 0, 50).".......";
> ?>
>
>
> I have been using this but how can I make sure I do not split a word in
> half? - Finishing on a <space> would probably do it.

You could use wordwrap() to wrap lines at 50 characters and then just take
the first line....

http://us3.php.net/wordwrap

-philip

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация