Divide an isosceles triangle in two parts with ratio of areas as n : m | Function to return the height ; type cast the n , m into float ; calculate the height for cut ; Driver code
< ? php function heightCalculate ( $ H , $ n , $ m ) { $ N = $ n * 1.0 ; $ M = $ m * 1.0 ; $ h = $ H * sqrt ( $ N / ( $ N + $ M ) ) ; return $ h ; } $ H = 10 ; $ n = 3 ; $ m = 4 ; echo heightCalculate ( $ H , $ n , $ m ) ; ? >