PHP - substr() function to limit text

0 votes
226 views
added Sep 24, 2019 in PHP by lcjr First Warrant Officer (11,790 points)
edited Nov 8, 2019 by LC Marshal
<?php echo substr($description, 0, 350) ?>

 

1 Response

0 votes
responded Sep 24, 2019 by lcjr First Warrant Officer (11,790 points)
//combined limiting text to 350 + strip the HTML
<?php echo substr(strip_tags($description),0,350); ?>

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...