The php two-dimensional array calculates the maximum value for you, and now another array $ a = {[0] = & gt; {123, Zhang San, 45}, [1] = & gt; {123, Zhang San, 60}, [2] = & gt; {234, Li Si, 47}, [3] = & gt; {234, Li Si, 68 }, [4] = & gt; {234, Li Si, 87}, calculate the maximum value of the php two-dimensional array of Zhang San and Li Si scores
Hope you guys, now another array $ a = {[0] => {123, Michael, 45}, [1] => {123, Michael, 60 }, [2] => {234, Li Si, 47}, [3] => {234, Li Si, 68}, [4] => {234, Li Si, 87 }}, find the maximum score (the last value) of Zhang Sanhe and Li Si. you don't need to use mysql. you only need to use the php array operation. please advise !!!
------ Solution --------------------
PHP code
$ A = array (123, 'Zhang San', 45), array (123, 'Zhang San', 60), array (234, 'Li Si', 47 ), array (234, 'Lily', 68), array (234, 'Lily', 87),); foreach ($ a as $ v) {if (! $ R [$ v [1]) $ r [$ v [1] = 999; $ r [$ v [1] = min ($ r [$ v [1], $ v [2]);} print_r ($ r );