Area of decagon inscribed within the circle | Function to find the area of the decagon ; radius cannot be negative ; area of the decagon ; Driver code
< ? php function area ( $ r ) { if ( $ r < 0 ) return -1 ; $ area = ( 5 * pow ( $ r , 2 ) * ( 3 - sqrt ( 5 ) ) * ( sqrt ( 5 ) + ( 2 * sqrt ( 5 ) ) ) ) / 4 ; return $ area ; } $ r = 8 ; echo area ( $ r ) . " STRNEWLINE " ; ? >