How PHP Reverse Number Program Works?

reverse.png
It is very easy to reverse a number using PHP string function strrev(). But here i will show you without using strrev() function.
fucntion findReverseNumber($number){

$reverse_number = 0;
while ($number != 0)
{
$reverse_number = $reverse_number * 10 + $number % 10;
$number         =  ($number/ 10); 
}
 
return $reverse_number;

}

echo findReverseNumber(15145);

Output:

54151