3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $master = array(); $arrColors = array('R', 'B', 'G' ,'Y'); $arrNumbers = array('1', '2', '3', '4'); foreach($arrColors as $color) { foreach($arrNumbers as $num) { array_push($master, $num); //$master += array($color => $num); //echo $color.' => '.$num; //echo "\n"; } array_push($master, $master); } print_r($master);
based on aabtm
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 ) [5] => 1 [6] => 2 [7] => 3 [8] => 4 [9] => Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 ) [5] => 1 [6] => 2 [7] => 3 [8] => 4 ) [10] => 1 [11] => 2 [12] => 3 [13] => 4 [14] => Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 ) [5] => 1 [6] => 2 [7] => 3 [8] => 4 [9] => Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 ) [5] => 1 [6] => 2 [7] => 3 [8] => 4 ) [10] => 1 [11] => 2 [12] => 3 [13] => 4 ) [15] => 1 [16] => 2 [17] => 3 [18] => 4 [19] => Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 ) [5] => 1 [6] => 2 [7] => 3 [8] => 4 [9] => Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 ) [5] => 1 [6] => 2 [7] => 3 [8] => 4 ) [10] => 1 [11] => 2 [12] => 3 [13] => 4 [14] => Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 ) [5] => 1 [6] => 2 [7] => 3 [8] => 4 [9] => Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 ) [5] => 1 [6] => 2 [7] => 3 [8] => 4 ) [10] => 1 [11] => 2 [12] => 3 [13] => 4 ) [15] => 1 [16] => 2 [17] => 3 [18] => 4 ) )