Program to find sum of series 1 + 2 + 2 + 3 + 3 + 3 + . . . + n | Function to find sum of series . ; Driver Code ; Function call
< ? php function sumOfSeries ( $ n ) { $ sum = 0 ; for ( $ i = 1 ; $ i <= $ n ; $ i ++ ) $ sum = $ sum + $ i * $ i ; return $ sum ; } $ n = 10 ; echo ( sumOfSeries ( $ n ) ) ; ? >