Cainiao asked me a simple logic question. I want to implement the 62 hexadecimal function. However, the following code can only be returned and cannot be returned. I don't know why, function & nbsp; dwz ($ id, $ str = "") {$ a = array ("0", "1", "2", "3 ", "4", "5", "6", "7", "8", "9. Cainiao asks a simple logic question.
I want to implement the 62 hexadecimal function, but the following code can only be echo and cannot be returned. I don't know why.
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 ($ ));
$ Xs = $ id % sizeof ($ );
If ($ zs> = sizeof ($ )){
$ Str = $ a [$ xs]. $ str;
Dwz ($ zs, $ str );
}
Else {
If ($ str = ""){
Return $ a [$ zs]. $ a [$ xs];
}
Else {
Echo $ a [$ zs]. $ str; // output only
Return $ a [$ zs]. $ str; // no value is returned. I don't know why
}
}
}
For ($ I = 999990; $ I <= 1000000; $ I ++ ){
Echo dwz ($ I );
Echo"
";
}
Logic Cainiao:
------ Solution --------------------
Row 3 dwz ($ zs, $ str );
No response
$ Str = dwz ($ zs, $ str );
Return $ str is also required at the end of the function;
------ Solution --------------------
If ($ zs> = sizeof ($ )){
$ Str = $ a [$ xs]. $ str;
Dwz ($ zs, $ str); // add return: return dwz ($ zs, $ str) here );
}