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.

 

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.