e1seix Posted November 19, 2008 Share Posted November 19, 2008 Right I have the basic grasp of this, however what I want to use it for is... if the return of a string is GREATER than the specified ($string = substr($name,0,75); in this case 75 digits, I want to put a "..." after to show the name is not showing in full as opposed to an abrupt stop mid-word when it's printed 75 digits. Easy, put "..." after printing $string. However, there will be other strings that do not exceed 75 digits and so "..." looks a bit silly after it. Any ideas? Link to comment https://forums.phpfreaks.com/topic/133391-substr-query/ Share on other sites More sharing options...
genericnumber1 Posted November 19, 2008 Share Posted November 19, 2008 You could just add an additional parameter <?php if(strlen($name) < 75)) { $string = $name; } else { $string = substr($name,0,75) . '...'; } ?> Link to comment https://forums.phpfreaks.com/topic/133391-substr-query/#findComment-693759 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.