If c is even number then it means digit extracted is at even place
if ( $ c % 2 == 0 ) $ sumEven += $ n % 10 ; else $ sumOdd += $ n % 10 ; $ n = floor ( $ n / 10 ) ; $ c ++ ; } echo " Sum odd = " , ▁ $ sumOdd , ▁ " " ; STRNEWLINE echo ▁ " Sum even = " }