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