Reverse a Number: Write a PHP function to reverse a given integer.

function reverseNumber($num) {
    return (int)strrev((string)$num);
}

// Example usage:
$number = 12345;
echo "Reversed number: " . reverseNumber($number);

Related Posts

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
Artificial Intelligence