robert_gsfame Posted September 21, 2009 Share Posted September 21, 2009 Suppose i have this words " I am one of members of PHPFreaks Forum " and i want to make this words into " I am one of members of PHP..." Using strtok then how to do it let say: $words = "I am one of members of PHPFreaks Forum" then how to break this words with using strtok..if i want to break based on space there i can do it like this strtok($words, " "); But in this case words will be change to " ... " after reach strlen Can anyone help me Link to comment https://forums.phpfreaks.com/topic/174966-strtok-help/ Share on other sites More sharing options...
waynew Posted September 21, 2009 Share Posted September 21, 2009 $my_string = "I am one of the members of the PHP Freaks Forum"; $max_length = 50; if(strlen($my_string) > $max_length){ echo substr($my_string,0,$max_length)." [...]"; } else{ echo $my_string; } Link to comment https://forums.phpfreaks.com/topic/174966-strtok-help/#findComment-922143 Share on other sites More sharing options...
robert_gsfame Posted September 21, 2009 Author Share Posted September 21, 2009 thanks for your great answer, is it possible to do it with strtok ?? Link to comment https://forums.phpfreaks.com/topic/174966-strtok-help/#findComment-922149 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.