3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $sum = 0; $master = array(); $arrColors = array('R', 'B', 'G' ,'Y'); $arrNumbers = array('1', '2', '3', '4'); foreach($arrNumbers as $num) { foreach($arrColors as $colorK => $colorV) { $temp = $colorV.' - '.$num; // if ($num != $num[$colorK]) { // $sum += $num; //} //array_push($master, $temp); } } print_r($master); echo "\n"; print_r ("The sum is ".$sum);
based on U2Whh
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( ) The sum is 0