- array_reduce: documentation ( source)
- var_export: documentation ( source)
<?php
$data = [
['Key1' => 'Key1', 'Total' => 13],
['Key2' => 'Key2', 'Total' => 117],
['Key2' => 'Key3', 'Total' => 39],
];
var_export(
array_reduce(
$data,
fn($result, $row) =>
$result['Total'] > $row['Total']
? $result
: $row,
['Key1' => null, 'Total' => PHP_INT_MIN]
)
);