You are here: Re: Brief description pulled from long description « PHP Programming Language « IT news, forums, messages
Re: Brief description pulled from long description

Posted by d on 02/14/06 17:33

"Mikey P" <phatnugs420@comcast.net> wrote in message
news:1139928542.712778.211530@g47g2000cwa.googlegroups.com...
> basically i have a description in a mysql table. Is there any way to
> pull say like the first 10-20 words for a brief description?

If you want an actual count of words, you can do this:

$brief=join(" ", array_slice(explode(" ", $description), 0, 10));

where $description is your long description, and 10 is how many words you
want. Bear in mind usually you'd work out how long your short description
should be on its letter-count, as that's more accurate (though still not
pixel-accurate, obviously).

> Thanks so much,
> Mike
>

 

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

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