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);

preferences:
52.45 ms | 409 KiB | 5 Q