Heim  >  Artikel  >  Backend-Entwicklung  >  初学者问个简单的逻辑有关问题,求解答

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

WBOY
WBOYOriginal
2016-06-13 12:43:42825Durchsuche

菜鸟问个简单的逻辑问题,求解答
我是想实现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 />

逻辑 菜鸟 简单的
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn