3v4l.org

run code in 300+ PHP versions simultaneously
<?php $list = [ (object)['name' => 'Something', 'link' => 'high/over/there'], (object)['name' => 'Items', 'link' => 'this/is/foo/bar'], ]; array_walk($list, function ($v) { if ($v->name == 'Items') $v->link = dirname($v->link); }); var_export($list);
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.29, 8.0.0 - 8.0.19, 8.1.0 - 8.1.6
array ( 0 => (object) array( 'name' => 'Something', 'link' => 'high/over/there', ), 1 => (object) array( 'name' => 'Items', 'link' => 'this/is/foo', ), )
Output for 7.2.0 - 7.2.34
array ( 0 => stdClass::__set_state(array( 'name' => 'Something', 'link' => 'high/over/there', )), 1 => stdClass::__set_state(array( 'name' => 'Items', 'link' => 'this/is/foo', )), )

preferences:
81.47 ms | 410 KiB | 5 Q