Program to check Plus Perfect Number | function to check plus perfect number ; calculating number of digits ; calculating plus perfect number ; checking whether number is plus perfect or not ; Driver Code
< ? php function checkplusperfect ( $ x ) { $ temp = $ x ; $ n = 0 ; while ( $ x != 0 ) { $ x /= 10 ; $ n ++ ; } $ x = $ temp ; $ sum = 0 ; while ( $ x != 0 ) { $ sum += pow ( $ x % 10 , $ n ) ; $ x /= 10 ; } return ( $ sum == $ temp ) ; } $ x = 9474 ; if ( checkplusperfect ( ! $ x ) ) echo " Yes " ; else echo " No " ; ? >