Number in Reverse Order in PHP

Number in Reverse Order in PHP. By using this program we can print the number in reverse using php mod. The modulo operator is an arithmetic operator denoted by percent. The remainder of an integer division is produced by the modulo division operator. When x is divided by y and both x and y are integers, the equation x percent y. provides the residual.

<!DOCTYPE html>


$num = 4973489;
$x = 0;
$n =$num;

$mod = $num%10;
$x = $x * 10 + $mod;
$num = $num/10;
echo "Reverse of $n is $x.";




Reverse of 4973489 is 9843794.

Floor in Php

Another built-in function in PHP iterpreter is the floor() function. Any float number can be passed as an argument, and it will be rounded down to the next lowest integer. Because the range of float is larger than that of integer, this function always returns a float number.

Only one parameter is required for both ceil() and floor(): the number to round. Ceil() rounds the number to the next integer higher than its current value, whereas floor() rounds it to the nearest integer lower than its current value. Round() will always round up a number that is exactly half way between two integers.

While Loop and How to Execute

The while construct is made up of a code block and a condition/expression. This process is repeated until the condition/expression is no longer true. The control structure is sometimes known as a pre-test loop since the while loop examines the condition/expression before executing the block.