Jump to content

limit letters of fetched rows...


violinrocker

Recommended Posts

if i have in my fetched row

"A summary or recap is a shortened version of the original. The main purpose of such a simplification is to highlight the major points from the original (much longer) subject, e.g. a text, a film or an event. The target is to help the audience get the gist in a short period of time."

 

how do i limit the letters so that it would look like"A summary or recap is a shortened version of the original. The main purpose of such a simplification is to highlight the major points from the original..."

Link to comment
https://forums.phpfreaks.com/topic/173199-limit-letters-of-fetched-rows/
Share on other sites

So, you want to show the first 151 characters, then add and ellipsis?

 

$haystack= "A summary or recap is a shortened version of the original. The main purpose of such a simplification is to highlight the major points from the original (much longer) subject, e.g. a text, a film or an event. The target is to help the audience get the gist in a short period of time.";

$needle = substr($haystack, 0, 151);
$newString = $needle . '...';
print($newString);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.