How to reverse a number in php without built in functions


April 25, 2012PHPNo comments

A Simple PHP Home work code that returns the reverse of a given number,

The Logic here is simple. First get the given number and extract the final digit. Initially the reverse of the number will be zero, on each iteration multiply the reverse with 10 and add the modulus result.

Leave a Reply