3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function changeNames($people) { foreach ($people as $key => $person) { $people[$key]['name'] = strtoupper($person['name']); } return $people; } $myPeople = [ ['name' => 'foo'], ['name' => 'bar'] ]; $myPeople = changeNames($myPeople); var_dump($myPeople);
based on kOljB
Output for 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.30 - 7.2.7
array(2) { [0]=> array(1) { ["name"]=> string(3) "FOO" } [1]=> array(1) { ["name"]=> string(3) "BAR" } }