ARTICLE AD BOX
Here the code show results.
WWE WWE WWF WWE WWF RAW WWE WWF RAW ECW WWE WWF RAW ECW NXTBut I want to get Results Like.
WWE WWF RAW ECW NXT WWF RAW ECW NXT RAW ECW NXT ECW NXT NXTCan anyone modify following codes according to my wanting?
Code Is:
<?php $stringSentence = 'WWE WWF RAW ECW NXT SMACKdown'; $stringSentence = preg_replace('/\s+/', ' ', $stringSentence); $buffer = ''; $count = 1; $length = strlen($stringSentence); for ($i = 0; $i < $length; $i++) { if ($stringSentence[$i] !== ' ') { $buffer .= $stringSentence[$i]; } else { //echo ' '.$count++.' '.$buffer.'</br>'; $pieces = explode(" ", $stringSentence); $first_part = implode(" ", array_splice($pieces, 0, $count++)); echo ''.$first_part.'</br>'; $buffer = ''; } } ?>Explore related questions
See similar questions with these tags.
