text: Write a program to reverse digits of a number | PHP program to reverse digits of a number ; Recursive function to reverse digits of num ; Driver Code
code: < ? php $ rev_num = 0 ; $ base_pos = 1 ; function reversDigits ( $ num ) { global $ rev_num ; global $ base_pos ; if ( $ num > 0 ) { reversDigits ( ( int ) ( $ num / 10 ) ) ; $ rev_num += ( $ num % 10 ) * $ base_pos ; $ base_pos *= 10 ; } return $ rev_num ; } $ num = 4562 ; echo " Reverse ▁ of ▁ no . ▁ is ▁ " , reversDigits ( $ num ) ; ? >