3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ [ 'name' => 'Electric Khodro', 'price' => 12912 ], [ 'name' => 'Iran Khodro', 'price' => 15218 ], [ 'name' => 'Iran arghaam', 'price' => 8853 ] , // ... ]; function getHighestPrice($data,$name){ $prices = array_column($data,$name); return $prices == [] ? NULL : max($prices); } $maxPrice = getHighestPrice($data,'price'); echo $maxPrice;

preferences:
27.26 ms | 405 KiB | 5 Q