PHP forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.
March 2024
SunMonTueWedThuFriSat
     12
3456789
10111213141516
17181920212223
24252627282930
31      

Calendar Calendar

Latest topics
» Kabaddi, Kabaddi, Kabaddi, Kabaddi......PHP?
Word count wrap EmptyFri Jul 22, 2011 1:37 pm by shyamsunder

» Thousands of Free PHP Scripts Recommended
Word count wrap EmptyWed May 18, 2011 10:33 am by bizboy12

» PHP form validation problem?
Word count wrap EmptyWed Jan 12, 2011 1:25 pm by simy202

» string wrap
Word count wrap EmptySat Aug 02, 2008 2:06 pm by scvinodkumar

» retrieving current date rows
Word count wrap EmptyTue Jul 15, 2008 3:25 am by scvinodkumar

» number in words
Word count wrap EmptyTue Apr 29, 2008 3:10 pm by scvinodkumar

» Simple PHP Form Field Generator
Word count wrap EmptyFri Apr 25, 2008 12:28 pm by scvinodkumar

» PHP password generator
Word count wrap EmptyFri Apr 18, 2008 7:24 pm by scvinodkumar

» PHP Script to Extract Email Address from any text
Word count wrap EmptyFri Apr 18, 2008 7:18 pm by scvinodkumar

Search
 
 

Display results as :
 


Rechercher Advanced Search

Affiliates
free forum
 


Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Word count wrap

Go down

Word count wrap Empty Word count wrap

Post  scvinodkumar Sat Mar 29, 2008 10:02 pm

<?php
function limit_text($text, $limit) {
$text = strip_tags($text);
$words = str_word_count($text, 2);
$pos = array_keys($words);
if (count($words) > $limit) {
$text = substr($text, 0, $pos[$limit]) . ' ...';
}
return $text;
}
?>

scvinodkumar
Admin

Posts : 40
Join date : 2008-01-30

https://solutions.aforumfree.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum