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) { if($j>1) $samp = $value."($j)"; array_push($color,$samp); $j++; } } print_r($color);
Output for 5.0.4 - 7.1.0
Notice: Undefined variable: samp in /in/jqFQa on line 12 Array ( [0] => [1] => red(2) [2] => red(3) [3] => red(4) [4] => red(5) [5] => red(5) [6] => green(2) [7] => green(3) [8] => green(4) [9] => green(5) )
Output for 4.3.0 - 5.0.3
Notice: Undefined variable: samp in /in/jqFQa on line 12 Array ( [0] => [1] => red(2) [2] => red(3) [3] => red(4) [4] => red(5) [5] => red(5) [6] => green(2) [7] => green(3) [8] => green(4) [9] => green(5) )