redarrow Posted July 24, 2007 Share Posted July 24, 2007 if there are more then 1 charecter the same get rid of one of them charecters cheers bad example but you can see what iam trying. <?php $x="hello there i am reeedddaaarrrooowww"; $letters=array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","v","w","x","y","z"); $e=explode(' ',$x); for($i=0; $i<count($x); $i++){ $y=implode(' ',$letters); if($x[$i]==strlen($y)>2){ $x[$i]-1; echo $x[$i]; } } ?> Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted July 24, 2007 Share Posted July 24, 2007 so your final result looks like this? helo ther i am redarow Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 24, 2007 Author Share Posted July 24, 2007 were the redarrow part loses the repeated charecters. example goes throw the loop sees that the word redarrow got more then or 3 extrea char and get rid of them by one sorry hard to exsplain. Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted July 24, 2007 Share Posted July 24, 2007 well... what if there is a word like: hellllllllllllllllo and the real word is hello but if you want to remove all the repeating letters, the word will print out helo since a ll is a repeating letter. So... how will you know when to stop? Quote Link to comment 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.