dezkit Posted June 22, 2010 Share Posted June 22, 2010 How would I go about doing this? So far I got: <?php $val = 255; if(strlen($str) > $val)){ // wat do? } ?> Link to comment https://forums.phpfreaks.com/topic/205565-if-more-than-255-characters-echo-255-characters-then/ Share on other sites More sharing options...
Alex Posted June 22, 2010 Share Posted June 22, 2010 if(strlen($str) > 255) { $str = substr($str, 0, 255) . '...'; } substr Link to comment https://forums.phpfreaks.com/topic/205565-if-more-than-255-characters-echo-255-characters-then/#findComment-1075639 Share on other sites More sharing options...
dezkit Posted June 22, 2010 Author Share Posted June 22, 2010 works perfectly, thanks a bunch. Link to comment https://forums.phpfreaks.com/topic/205565-if-more-than-255-characters-echo-255-characters-then/#findComment-1075641 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.