3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $items = [ 'ITEM-1' => [ 'foo' => false, 'bar' => 'test 1'], 'ITEM-2' => [ 'foo' => true, 'bar' => 'test 2'], 'ITEM-3' => [ 'foo' => false, 'bar' => 'test 3'], ]; $items = array_filter($items, function(&$item) { if($item['foo']) { return false; } $item['bar'] = 'BAM!'; return true; }); var_dump($items);
Output for 7.0.0 - 7.2.11
array(2) { ["ITEM-1"]=> array(2) { ["foo"]=> bool(false) ["bar"]=> string(6) "test 1" } ["ITEM-3"]=> array(2) { ["foo"]=> bool(false) ["bar"]=> string(6) "test 3" } }
Output for 5.5.0 - 5.6.38, hhvm-3.11.1, hhvm-3.13.2, hhvm-3.17.3 - 3.22.0
array(2) { ["ITEM-1"]=> array(2) { ["foo"]=> bool(false) ["bar"]=> string(4) "BAM!" } ["ITEM-3"]=> array(2) { ["foo"]=> bool(false) ["bar"]=> string(4) "BAM!" } }
Output for hhvm-3.10.1, hhvm-3.12.14, hhvm-3.15.4

Process exited with code 137.