<?php /** * Created by PhpStorm. * User: Administrator * Date: 2022/4/20/020 * Time: 15:19 */ echo"<pre>"; $a = array(array('id'=>'01','name'=>'liubei','yuwen'=>90), array('id'=>'02','name'=>'guanyu','yuwen'=>80), array('id'=>'03','name'=>'zhuangfei','yuwen'=>70), array('id'=>'04','name'=>'caocao','yuwen'=>98), array('id'=>'05','name'=>'sunquan','yuwen'=>92), array('id'=>'06','name'=>'zhugeliang','yuwen'=>99), ); print_r($a); $max=$a[0]['yuwen']; $p=0; //$sanguo=array('shhuguo'=>'liubei','weiguo'=>'caocao','wuguo'=>'sunquan'); //foreach($sanguo as $value) // echo $value.'<br>'; //第一种 //第二种 //foreach($a as $k=>$v){ // if($v['yuwen']>$max){ // $po=$k; // $max=$v['yuwen']; // } //} for($i=1;$i<count($a);$i++){ if($max<$a[$i]['yuwen']){ $max=$a[$i]['yuwen']; $p=$i; } } echo'zuigaofen:'.$a[$p]['id'].$a[$p]['name'].$a[$p]['yuwen'];