请问怎么实现判断有多少个访问成功200 有多少个访问失败404
$a = array( array('mode' => ' 200 47 '), array('mode' => ' 200 47 '), array('mode' => ' 404 47 '), array('mode' => ' 404 47 '), array('mode' => ' 200 47 '),);foreach($a as $t) { @$res[intval($t['mode'])]++;}print_r($res);
Array( [200] => 3 [404] => 2)
$arr = array(array('mode'=>'404 47'),array('mode'=>'200 47'),array('mode'=>'404 47'));$i = 0;$x = 0;$y = 0;while($i<count($arr)){ $a = explode(' ',$arr[$i]['mode']); if($a[0]=='404'){ $x = $x + 1 ; }elseif($a[0]=='200'){ $y = $y + 1; } $i++;}echo '404:'.$x,',200:'.$y;
$a = array( array('mode' => ' 200 47 '), array('mode' => ' 200 47 '), array('mode' => ' 404 47 '), array('mode' => ' 404 47 '), array('mode' => ' 200 47 '),);foreach($a as $t) { @$res[intval($t['mode'])]++;}print_r($res);
Array( [200] => 3 [404] => 2)