<?php function a($i){ if( $i==20 ){ return $i; }else{ a($i+1); } } echo a(1); ?>
对比上下两端代码,分别执行会发现上方代码没有返回任何东西,下方代码正确的返回了20?奇怪~
<?php function a($i){ if( $i==20 ){ return $i; }else{ return a($i+1); } } echo a(1); ?>
<?php function a($i){ if( $i==20 ){ return $i; }else{ a($i+1); } } echo a(1); ?>
对比上下两端代码,分别执行会发现上方代码没有返回任何东西,下方代码正确的返回了20?奇怪~
<?php function a($i){ if( $i==20 ){ return $i; }else{ return a($i+1); } } echo a(1); ?>