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($arrColor 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 LX12p
Output for 5.1.0 - 5.6.28, 7.0.0 - 7.1.0
Notice: Undefined variable: arrColor in /in/U2Whh on line 8 Warning: Invalid argument supplied for foreach() in /in/U2Whh on line 8 Notice: Undefined variable: arrColor in /in/U2Whh on line 8 Warning: Invalid argument supplied for foreach() in /in/U2Whh on line 8 Notice: Undefined variable: arrColor in /in/U2Whh on line 8 Warning: Invalid argument supplied for foreach() in /in/U2Whh on line 8 Notice: Undefined variable: arrColor in /in/U2Whh on line 8 Warning: Invalid argument supplied for foreach() in /in/U2Whh on line 8 Array ( ) The sum is 0
Output for hhvm-3.12.0
Notice: Undefined variable: arrColor in /in/U2Whh on line 15 Warning: Invalid argument supplied for foreach() in /in/U2Whh on line 15 Notice: Undefined variable: arrColor in /in/U2Whh on line 15 Warning: Invalid argument supplied for foreach() in /in/U2Whh on line 15 Notice: Undefined variable: arrColor in /in/U2Whh on line 15 Warning: Invalid argument supplied for foreach() in /in/U2Whh on line 15 Notice: Undefined variable: arrColor in /in/U2Whh on line 15 Warning: Invalid argument supplied for foreach() in /in/U2Whh on line 15 Array ( ) The sum is 0
Output for hhvm-3.10.0

Process exited with code 153.
Output for 4.3.0 - 4.3.10, 4.4.0 - 5.0.5
Warning: Invalid argument supplied for foreach() in /in/U2Whh on line 8 Warning: Invalid argument supplied for foreach() in /in/U2Whh on line 8 Warning: Invalid argument supplied for foreach() in /in/U2Whh on line 8 Warning: Invalid argument supplied for foreach() in /in/U2Whh on line 8 Array ( ) The sum is 0
Output for 4.3.11
Array ( ) The sum is 0