<?phpclass Solution {/*** 123* 321* @param $x* @return false|float|int*/public function reverse($x) {$res = 0;while ($x != 0) {$res = floor($res * 10 + $x % 10);$x = ($x > 0) ? floor($x / 10) : ceil($x / 10);if ($res > pow(2, 31) - 1 || $res < -pow(2, 31) - 1) {return 0;}}return $res;}}$cls = new Solution();$r = $cls->reverse(1230);print_r($r);
