首页  >  文章  >  后端开发  >  初学者问个简单的逻辑有关问题,求解答

初学者问个简单的逻辑有关问题,求解答

WBOY
WBOY原创
2016-06-13 12:43:42822浏览

菜鸟问个简单的逻辑问题,求解答
我是想实现62进制的功能,可是下面这段代码只能echo出来,不能返回,不知道是什么原因,求高手解答

<br />
function dwz($id,$str=""){<br />
	$a=array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z");<br />
	$zs=(int)($id/sizeof($a));<br />
	$xs=$id%sizeof($a);<br />
	if($zs>=sizeof($a)){<br />
		$str=$a[$xs].$str;<br />
		dwz($zs,$str);<br />
	}<br />
	else{<br />
		if($str==""){<br />
			return $a[$zs].$a[$xs];<br />
		}<br />
		else{<br />
			echo   $a[$zs].$str;//这里只能输出<br />
			return $a[$zs].$str;//返回没值,不知道什么原因<br />
		}<br />
	}<br />
}<br />
for($i=999990;$i<=1000000;$i++){<br />
	echo dwz($i);<br />
	echo "<br>";<br />
}<br />

逻辑 菜鸟 简单的
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn