3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array[] = array('first'=>'jake','last'=>'quattrocchi'); $array[] = array('first'=>'david'); foreach($array as $key=>$value){ $value['first'] = 'adfgadgadfg'; unset($key); unset($value); } var_dump($array); echo $key; var_dump($value);
based on JeSFC
Output for 5.0.4 - 5.6.28, hhvm-3.10.0 - 3.13.2, 7.0.0 - 7.1.0
array(2) { [0]=> array(2) { ["first"]=> string(4) "jake" ["last"]=> string(11) "quattrocchi" } [1]=> array(1) { ["first"]=> string(5) "david" } } Notice: Undefined variable: key in /in/tuoFS on line 13 Notice: Undefined variable: value in /in/tuoFS on line 14 NULL
Output for 4.3.0 - 5.0.3
array(2) { [0]=> array(2) { ["first"]=> string(4) "jake" ["last"]=> string(11) "quattrocchi" } [1]=> array(1) { ["first"]=> string(5) "david" } } Notice: Undefined variable: key in /in/tuoFS on line 13 Notice: Undefined variable: value in /in/tuoFS on line 14 NULL