Guest Posted May 11, 2010 Share Posted May 11, 2010 is there a function in php that could shorten the words if the words exceed 15 characters ?? thanks Link to comment https://forums.phpfreaks.com/topic/201416-function-to-shorten-words/ Share on other sites More sharing options...
cs.punk Posted May 11, 2010 Share Posted May 11, 2010 http://php.net/manual/en/function.substr.php Description string substr ( string $string , int $start [, int $length ] ) Returns the portion of string specified by the start and length parameters. Link to comment https://forums.phpfreaks.com/topic/201416-function-to-shorten-words/#findComment-1056759 Share on other sites More sharing options...
Guest Posted May 13, 2010 Share Posted May 13, 2010 i want to shorten only the big words, not to shorten a whole string example: "this is a text with small words and a big word like " anticonstitutionally " and i want to shorten words that exceed 10 characters" would result in "this is a text with small words and a big word like " anticonsti" and i want to shorten words that exceed 10 characters" Link to comment https://forums.phpfreaks.com/topic/201416-function-to-shorten-words/#findComment-1057590 Share on other sites More sharing options...
trq Posted May 13, 2010 Share Posted May 13, 2010 You will need to write your own function for that. Link to comment https://forums.phpfreaks.com/topic/201416-function-to-shorten-words/#findComment-1057591 Share on other sites More sharing options...
cs.punk Posted May 13, 2010 Share Posted May 13, 2010 What would you like to use this for? Link to comment https://forums.phpfreaks.com/topic/201416-function-to-shorten-words/#findComment-1057630 Share on other sites More sharing options...
Guest Posted May 21, 2010 Share Posted May 21, 2010 What would you like to use this for? sorry for late reply... on my website i have a menu that display the last post of my forum. when a user move the mouse over a post, it display a "popup" with the first words of the post... but sometimes the post contains long words and the words will appear outside of the popup because they are too long so i need to shorten the words like in the example i gave example: "this is a text with small words and a big word like " anticonstitutionally " and i want to shorten words that exceed 10 characters" would result in "this is a text with small words and a big word like " anticonsti" and i want to shorten words that exceed 10 characters" Link to comment https://forums.phpfreaks.com/topic/201416-function-to-shorten-words/#findComment-1061535 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.