Jump to content

Trimming first part of an text and continuing from the part trimmed.


hantousha

Recommended Posts

<? 
$out = preg_replace('/^(.{701}[^.]*).*/i','$1.',$detrsltnewsrow[news_desc]);
echo $out; 
?>

</td></tr><tr><td colspan="2" class="para" style="padding-left:10px;">

<?= 
substr(stripslashes(trim($detrsltnewsrow[news_desc])),701)
?>
                                             
</td></tr>

 

I have the above snippet.. The first php statement, basically grasp the first 701 characters with the closet next stop "." character and out puts it. then out puts the HTML tags

 

I have a problem with the second statement. I want to output anything after what has been outputted by:

<? 
$out = preg_replace('/^(.{701}[^.]*).*/i','$1.',$detrsltnewsrow[news_desc]);
echo $out; 
?>

 

 

So need the correct syntax for

<?= 
substr(stripslashes(trim($detrsltnewsrow[news_desc])),701)
?>

 

Currently it breaks at exactly the 701 character, want it to continue from the sentence the first code ended in.

 

Link to comment
Share on other sites

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.