3v4l.org

run code in 300+ PHP versions simultaneously
<?php $inStr = 'Hey you. guys'; $tokens = array(); $tokenList = explode(' ',$inStr); foreach($tokenList as $bigToken) { $tokens[] = $bigToken; //take care of individual words $tokens = array_merge($tokens, str_split($bigToken)); //take care of single letters for($i = 2; $i < strlen($bigToken); $i++) { $tempArr = str_split($bigToken, $i); $tokens[] = array_shift($tempArr); //only need the first element here. } } print_r($tokens);

preferences:
36.58 ms | 402 KiB | 5 Q