Largest cube that can be inscribed within a right circular cylinder | Function to find the volume of the cube ; height and radius cannot be negative ; volume of the cube ; Driver code
< ? php function cube ( $ h , $ r ) { if ( $ h < 0 && $ r < 0 ) return -1 ; $ a = pow ( $ h , 3 ) ; return $ a ; } $ h = 5 ; $ r = 4 ; echo cube ( $ h , $ r ) ; ? >