3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $colors = array( 'red', 'green' ); $color=array(); foreach($colors as $value) { $j=1; while($j <6) {$samp = $value; if($j>1) $samp = $value."($j)"; array_push($color,$samp); $j++; } } print_r($color);
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [0] => red [1] => red(2) [2] => red(3) [3] => red(4) [4] => red(5) [5] => green [6] => green(2) [7] => green(3) [8] => green(4) [9] => green(5) )