Sum of first n natural numbers | Function to find the sum of series ; Driver code
< ? php function seriesSum ( $ n ) { return ( $ n * ( $ n + 1 ) * ( $ n + 2 ) ) / 6 ; } $ n = 4 ; echo ( seriesSum ( $ n ) ) ; ? >