Jump to content

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);

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.