text: Program to find area of a Circular Segment | Function to find area of segment ; Calculating area of sector ; Calculating area of triangle ; Driver Code
code: < ? php function area_of_segment ( $ radius , $ angle ) { $ pi = 3.14159 ; $ area_of_sector = $ pi * ( $ radius * $ radius ) * ( $ angle / 360 ) ; $ area_of_triangle = 1 / 2 * ( $ radius * $ radius ) * sin ( ( $ angle * $ pi ) / 180 ) ; return $ area_of_sector - $ area_of_triangle ; } $ radius = 10.0 ; $ angle = 90.0 ; echo ( " Area ▁ of ▁ minor ▁ segment ▁ = ▁ " ) ; echo ( area_of_segment ( $ radius , $ angle ) ) ; echo ( " STRNEWLINE " ) ; echo ( " Area ▁ of ▁ major ▁ segment ▁ = ▁ " ) ; echo ( area_of_segment ( $ radius , ( 360 - $ angle ) ) ) ; ? >