3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $data = array ( 'prd' => array ( 0 => '1', 1 => '2', 2 => '3', 3 => '4', 4 => '5', 5 => '6', 6 => '7', 7 => '8', ), 'price' => array ( 0 => 'a', 1 => 'b', 2 => 'c', 3 => 'd', 4 => 'e', 5 => 'f', 6 => 'g', 7 => 'h', ) ); #for ($x = 0; $x< count($data['prd']); $x++) { # echo $data['prd'][$x] . " costs " . $data['price'][$x] . PHP_EOL; #} foreach($array as $key => $val) { echo $key . $val; }
based on uCqHo
Output for 5.1.0 - 7.2.0
Notice: Undefined variable: array in /in/Nr2QN on line 30 Warning: Invalid argument supplied for foreach() in /in/Nr2QN on line 30
Output for 4.3.0 - 4.3.10, 4.4.0 - 5.0.5
Warning: Invalid argument supplied for foreach() in /in/Nr2QN on line 30
Output for 4.3.11