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? } ?> Quote 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 Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.