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++) { $tokens[] = array_shift(str_split($bigToken, $i)); //only need the first element here. } } print_r($tokens);
Output for git.master, git.master_jit, rfc.property-hooks
Notice: Only variables should be passed by reference in /in/dkFFT on line 9 Notice: Only variables should be passed by reference in /in/dkFFT on line 9 Notice: Only variables should be passed by reference in /in/dkFFT on line 9 Notice: Only variables should be passed by reference in /in/dkFFT on line 9 Array ( [0] => Hey [1] => H [2] => e [3] => y [4] => He [5] => you [6] => y [7] => o [8] => u [9] => yo [10] => guys [11] => g [12] => u [13] => y [14] => s [15] => gu [16] => guy )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
40.04 ms | 402 KiB | 8 Q