Sum of the series 5 + 55 + 555 + . . up to n terms | function which return the the sum of series ; Driver code
< ? php function sumOfSeries ( $ n ) { return ( int ) ( 0.6172 * ( pow ( 10 , $ n ) - 1 ) - 0.55 * $ n ) ; } $ n = 2 ; echo ( sumOfSeries ( $ n ) ) ; ? >