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:
23.9 ms | 406 KiB | 5 Q