3v4l.org

run code in 300+ PHP versions simultaneously
<?php $objs = [ ['value'=>2, 'key'=>'a'], ['value'=>3, 'key'=>'b'] ]; print_r($objs); $keys = array_column($objs, 'key'); $index = array_search('a', $keys); if ($index !== false) { $objs[$index]['value'] = 5; } print_r($objs);

preferences:
15.18 ms | 407 KiB | 5 Q