PHP program to reverse a number

 in this program i'm going to show you how to reverse a number using php programming 

code:-


<?php  
 
$num =125;  
$x = 0;
$n =$num;
 
while(floor($num))
{  
$mod = $num%10;
$x = $x * 10 + $mod;  
$num = $num/10;
}  
echo "Reverse of $n is $x.";
?>


output:-

Reverse of 125 is 521.

Post a Comment

If you have any doubts, Please let me know
Thanks!

Previous Post Next Post