# Php program to print the number in reverse order

A Php program to print the number in reverse order. 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><html><body><?php \$num = 4973489; \$x = 0;\$n =\$num;while(floor(\$num)){ \$mod = \$num%10;\$x = \$x * 10 + \$mod; \$num = \$num/10;} echo "Reverse of \$n is \$x.";?></body></html>`

Output:

Reverse of 4973489 is 9843794.

#### What is floor in php and the difference between floor and round

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.

#### What is while 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.