<?php /** * Created by PhpStorm. * User: Administrator * Date: 2022/4/20/020 * Time: 15:00 */ echo"<pre>"; $sanguo=array(array('name'=>'liubei','yuwen'=>89,'shuxue'=>67), array('name'=>'guanyu','yuwen'=>45,'shuxue'=>22), array('name'=>'zhangfei','yuwen'=>12,'shuxue'=>5), array('name'=>'caocao','yuwen'=>75,'shuxue'=>24),); print_r($sanguo); $max=$sanguo[0]['yuwen']+$sanguo[0]['shuxue']; $p=0; for($i=0;$i<count($sanguo);$i++){ if($max<$sanguo[$i]['yuwne']+$sanguo[$i]['shuxue']){ $max<$sanguo[$i]['yuwne']+$sanguo[$i]['shuxue']; $p=$i; } } echo"总分最高分:".$sanguo[$p]['name'].$sanguo[$p]['yuwen'].$sanguo[$p]['shuxu']; echo"<br>分数为".$max;