3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ [ "code" => "BTC", "name" => "Bitcoin", "rate" => 1 ], [ "code" => "BCH", "name" => "Bitcoin Cash", "rate" => 7.06364 ], [ "code" => "USD", "name" => "US Dollar", "rate" => 8185.84 ], ]; $array = array_reduce($array, function($carry, $item) { $carry[$item["code"]] = $item; return $carry; }); echo $array["USD"]["rate"];

preferences:
14.51 ms | 404 KiB | 5 Q