Minimum time required to complete a work by N persons together | Function to calculate the time ; Driver Code
< ? php function calTime ( & $ arr , $ n ) { $ work = 0 ; for ( $ i = 0 ; $ i < $ n ; $ i ++ ) $ work += 1 / $ arr [ $ i ] ; return 1 / $ work ; } $ arr = array ( 6.0 , 3.0 , 4.0 ) ; $ n = sizeof ( $ arr ) ; echo calTime ( $ arr , $ n ) ; echo " ▁ Hours " ;