Find the sum of all the terms in the n | function to find the required sum ; sum = n * ( 2 * n ^ 2 + 1 ) ; Driver Code
< ? php function sumOfTermsInNthRow ( $ n ) { $ sum = $ n * ( 2 * pow ( $ n , 2 ) + 1 ) ; return $ sum ; } $ n = 4 ; echo " Sum ▁ of ▁ all ▁ the ▁ terms ▁ in ▁ nth ▁ row ▁ = ▁ " , sumOfTermsInNthRow ( $ n ) ; ? >