<?php
class ReverseNumber {
public function reverse() {
$input = 123;
$output = 0;
$temp = $input;
while ($temp > 0) {
$remainder = $temp % 10;
$output = ($output * 10) + $remainder;
$temp = (int)($temp / 10);
}
echo("Original Number: " . $input . "\n");
echo("Reverse Number: " . $output . "\n");
}
}
$obj = new ReverseNumber();
$obj->reverse();