php判断字符串在某个区间,并查询出对应区间的值
<?php $ranks = array(1900=>'32',1800=>'31',1700=>'30',1600=>'29',1500=>'28',1400=>'27',1300=>'26',1400=>'25',1100=>'24',1000=>'23',900 =>'22',800 =>'21',700 =>'20',600 =>'19',500 =>'18',400 =>'17',300 =>'16',200 =>'15',100 =>'14',0=>'13'); $rank_point = 1880; $rank_name = null; foreach($ranks as $check_rank_point=>$check_rank_name){ $rank_name = $check_rank_name; if($rank_point > $check_rank_point)break; } echo $rank_name; ?>
如有问题,请联系我,谢谢1