php关于数组中取出符合条件的值办法
$arr=array("50","128","30","270","150","15","78","28","99","100","200",)有以上数组,现在需要把0-...
$arr = array("50","128","30","270","150","15","78","28","99","100","200",)有以上数组,现在需要把0-100的取出来放到$arr1,再把100-200的取出来$arr2,再把200-300的取出来$arr3,应该怎么写???
展开
1个回答
2015-10-11
展开全部
<?php
$arr=array('');
foreach($arr as $k=>$v){
if($v>0&&$v<100){
$arr1[]=$v;
}elseif($v>100&&$v<200){
$arr2[]=$v;
}
}
追问
PHP Parse error: syntax error, unexpected T_FOREACH in
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询