如题所述
//性能最高的方法,不调用任何函数
function reverseNo($number) {
$res = "";
for ($i = 0;; $i ++) {
if ($number < 10) {
return $res . $number;
}
$n = $number % 10;
$res .= $n;
$number = (int) ($number / 10);
}
}
$number = 41235345;
$res = reverseNo($number);
var_dump($res);
function reverseNo($number) {
$res = "";
for ($i = 0;; $i ++) {
if ($number < 10) {
return $res . $number;
}
$n = $number % 10;
$res .= $n;
$number = (int) ($number / 10);
}
}
$number = 41235345;
$res = reverseNo($number);
var_dump($res);
温馨提示:答案为网友推荐,仅供参考