Sum of Series ( n ^ 2 | function that calculate the sum of the nth series ; using formula of the nth term ; Driver Code
< ? php function sum_series ( $ n ) { $ nSquare = $ n * $ n ; return $ nSquare * ( $ nSquare - 1 ) / 4 ; } $ n = 2 ; echo ( sum_series ( $ n ) ) ; ? >