Javatpoint Logo
Javatpoint Logo

Reverse number

A number can be written in reverse order.

For example

12345 = 54321

Logic:

  • Declare a variable to store reverse number and initialize it with 0.
  • Multiply the reverse number by 10, add the remainder which comes after dividing the number by 10.

Reversing Number in PHP

Example:

Below progrem shows digits reversal of 23456.

Output:

PHP Reverse th number 1

Reversing Number With strrev () in PHP

Example:

Function strrev() can also be used to reverse the digits of 23456.

Output:/strong>

PHP Reverse th number 2
Next TopicReverse String





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA