3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $items = array( 'ITEM-1' => array( 'foo' => false, 'bar' => 'test 1'), 'ITEM-2' => array( 'foo' => true, 'bar' => 'test 2'), 'ITEM-3' => array( 'foo' => false, 'bar' => 'test 3'), ); $items = array_filter($items, function(&$item) { if($item['foo']) { return false; } $item['bar'] = 'BAM!'; return true; }); var_dump($items);
based on TBtPM
Output for 7.0.0 - 7.2.0
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.3.20 - 5.6.28
array(2) { ["ITEM-1"]=> array(2) { ["foo"]=> bool(false) ["bar"]=> string(4) "BAM!" } ["ITEM-3"]=> array(2) { ["foo"]=> bool(false) ["bar"]=> string(4) "BAM!" } }