xyn Posted July 2, 2007 Share Posted July 2, 2007 Hey guys, From my earlier function. Basically I was wondering if anyone knows the function which allows you to set like "..." after a set amount of characters. thanks, Ash Link to comment https://forums.phpfreaks.com/topic/58106-solved-replace-a-set-amount-of-characters/ Share on other sites More sharing options...
hackerkts Posted July 2, 2007 Share Posted July 2, 2007 What you can do is use substr() and grab the maximum numbers of character then add "..." after it. Link to comment https://forums.phpfreaks.com/topic/58106-solved-replace-a-set-amount-of-characters/#findComment-288114 Share on other sites More sharing options...
corillo181 Posted July 2, 2007 Share Posted July 2, 2007 something like you want one line of text and then .... for like more click some here? user $number=strlen($str); to find out how mane letters are in Link to comment https://forums.phpfreaks.com/topic/58106-solved-replace-a-set-amount-of-characters/#findComment-288116 Share on other sites More sharing options...
xyn Posted July 2, 2007 Author Share Posted July 2, 2007 yeh that's basically it. I basically have a script which takes data from a mysql table. then fuinds out the amount of characters, and generates pages from it. But as its done by characters. say 500 characters per page. and the 500 characters exeeds duriong a word... like "Important" and displays "import" I'd prefer "Import..." so then the user knows to click NEXT for the next page. Link to comment https://forums.phpfreaks.com/topic/58106-solved-replace-a-set-amount-of-characters/#findComment-288121 Share on other sites More sharing options...
skali Posted July 2, 2007 Share Posted July 2, 2007 function shrink_str($str, $len){ $temp = substr($str,0,$len); $temp = $temp."....."; return $temp; } print shrink_str("abcdefghijklmnopqrstuvwxyz",10); Link to comment https://forums.phpfreaks.com/topic/58106-solved-replace-a-set-amount-of-characters/#findComment-288124 Share on other sites More sharing options...
xyn Posted July 2, 2007 Author Share Posted July 2, 2007 thx Link to comment https://forums.phpfreaks.com/topic/58106-solved-replace-a-set-amount-of-characters/#findComment-288136 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.