Rookie ask a simple logic question, seek answers
I want to achieve 62 of the functionality of the system, but the following code can only echo out, can not return, do not know what is the reason, seek expert answers
function DWZ ($id, $str = "") {
$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");
$zs = (int) ($id/sizeof ($a));
$xs = $id%sizeof ($a);
if ($zs >=sizeof ($a)) {
$STR = $a [$xs]. $str;
DWZ ($zs, $STR);
}
else{
if ($str = = "") {
return $a [$zs]. $a [$XS];
}
else{
echo $a [$zs]. $str;//This can only be output
return $a [$zs]. $str;//Return no value, do not know why
}
}
}
for ($i =999990; $i <=1000000; $i + +) {
echo DWZ ($i);
echo "
";
}
Logic Rookie simple.
Share to:
------Solution--------------------
Line 7th DWZ ($zs, $STR);
did not undertake to return
$str = DWZ ($zs, $STR);
Return $STR is also required at the end of the function;
------Solution--------------------
if ($zs >=sizeof ($a)) {
$STR = $a [$xs]. $str;
DWZ ($zs, $STR); Join Return:return DWZ here ($zs, $STR);
}