自己瞎玩的,大神帮我看看哪里可以更简单
<?php
$fruit=array('1','2','3','4','5','6','7','8','9','10');
foreach($fruit as $a=>$b)
{echo '<br>输出的编号是'.$a.',值为'.$b;}
echo '</br>';
for($fruit['0'],$a=0;$fruit['0']<=10;$fruit['0']++)
{$a=$fruit['0']+$a;}
echo '该数组的总值为'.$a;
echo '</br>';
if($fruit['0']==10)
{ echo 'ture';}
else {echo 'forre';};
switch($fruit['5']){
case 1:
$fruit['5']= $fruit['5'] + 10;
break;
case 2:
$fruit['5']=$fruit['5'] + 10;
default:
$fruit['5'] = $fruit['5'] + 10;
echo '输出结果为'.$fruit['5'];
}
?>