Program to find sum of harmonic series | Function to return sum of harmonic series ; Driver Code
< ? php function sum ( $ n ) { $ i ; $ s = 0.0 ; for ( $ i = 1 ; $ i <= $ n ; $ i ++ ) $ s = $ s + 1 / $ i ; return $ s ; } $ n = 5 ; echo ( " Sum ▁ is ▁ " ) ; echo ( sum ( $ n ) ) ; ? >