Loading…

Write a program to display Reverse of any number?

$num = 12345;
$revnum = 0;
while ($num > 1)
{
$rem = $num % 10;
$revnum = ($revnum * 10) + $rem;
$num = ($num / 10);
}

echo "Reverse number of 12345 is: $revnum";

Suggest An Answer

No suggestions avaliable!

Latest post from PHP interview questions

Ask Question