Rumah >pembangunan bahagian belakang >tutorial php >菜鸡求教,该如何处理
菜鸡求教
代码如下
<?php<br />function Contrast($arr,$r,$c,&$numb){<br /> if($arr[$r][$c]==$arr[$r][$c+1]){<br /> $c++;<br /> $numb++; <br /> Contrast($arr,$r,$c,$numb); <br /> }else{ <br /> echo $numb."</br>";<br /> return $numb; <br /> }<br />}<br /><br />$arr=array(array(0,0,0,1,1,1,1,1,1,0,0,));<br />$r=0;<br />$c=3;<br />$numb=0;<br />$d=Contrast($arr,$r,$c,$numb);<br />var_dump($d);<br />?>
<br /> if($arr[$r][$c]==$arr[$r][$c+1]){<br /> $c++;<br /> $numb++; <br /> Contrast($arr,$r,$c,$numb); <br /> }else{ <br />
<br /><?php<br />function Contrast($arr,$r,$c,&$numb){<br /> if($arr[$r][$c]==$arr[$r][$c+1]){<br /> $c++;<br /> $numb++; <br /> return Contrast($arr,$r,$c,$numb); <br /> }else{ <br /> echo $numb."</br>";<br /> return $numb; <br /> }<br />}<br /> <br />$arr=array(array(0,0,0,1,1,1,1,1,1,0,0,));<br />$r=0;<br />$c=3;<br />$numb=0;<br />$d=Contrast($arr,$r,$c,$numb);<br />var_dump($d);<br />?><br />