3v4l.org

run code in 300+ PHP versions simultaneously
<?php $total = array(); $total[] = array( "id" => 1, "account" => "hello world", "item" => "package", "quantity" => 10 ); $total[] = array( "id" => 2, "account" => "foo", "item" => "world", "quantity" => 100 ); $maxtotal; foreach ($total as $key => $value) { // $value is an array() with id, account, item, quantity $maxtotal = array_search( max($value), $value); // doesn't work } print_r( $maxtotal ); // should print out the array with id=2

preferences:
42.14 ms | 402 KiB | 5 Q