Returns sum of squares of digits of a number n . For example for n = 12 it returns 1 + 4 = 5
< ? php function sumDigitSquare ( $ n ) { $ sq = 0 ; while ( $ n ) { $ digit = $ n % 10 ; $ sq += $ digit * $ digit ; $ n = $ n / 10 ; } return $ sq ; }