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