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'; } var_dump($array); echo $key; echo $value;
based on pXBXb
Output for 5.4.0 - 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" } } 1 Notice: Array to string conversion in /in/rGq64 on line 11 Array
Output for 4.3.0 - 5.3.29
array(2) { [0]=> array(2) { ["first"]=> string(4) "jake" ["last"]=> string(11) "quattrocchi" } [1]=> array(1) { ["first"]=> string(5) "david" } } 1Array