PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php $arr = [ ['Андрей', 79999999999, '2016-04-23 11:03:27'], ['Семен', 79033333333, '2016-04-23 11:03:56'], ['Андрей', 79999999999, '2016-04-23 11:03:00'], ]; $res = array_reduce( $arr, function($res, $el) { if ( !isset($res[$el[1]]) || $res[$el[1]][2] < $el[2] ) { $res[$el[1]] = $el; } return $res; }, [] ); print_r(array_values($res));
Show:  
Copy Clear