Using this function we can extract first $lemgth words from $string
<?php
function wordlimit($string, $length = 50, $ellipsis = "...")
{
$words = explode(' ', $string);
if (count($words) > $length)
return implode(' ', array_slice($words, 0, $length)) . $ellipsis;
else
return $string;
}
?>
Friday, June 26, 2009
Php - How to display first n words of a paragraph ...
Subscribe to:
Post Comments (Atom)
Popular Hybrid Mobile App development frameworks
Popular Hybrid Mobile App development frameworks Hybrid Development Technologies List of best Hybrid App Development Frameworks ...
-
rint stylesheets are pretty well supported. In this article I’ll discuss what I think makes a good print stylesheet, and we’ll take a look a...
-
Popular Hybrid Mobile App development frameworks Hybrid Development Technologies List of best Hybrid App Development Frameworks ...
-
Aw snap, one of the final hurdles on the way to October 22nd has been passed: Windows 7 (and Windows Server 2008 R2, too) has been relea...
No comments:
Post a Comment