Choose points from two ranges such that no point lies in both the ranges | Function to find the required points ; Driver code
< ? php function findPoints ( $ l1 , $ r1 , $ l2 , $ r2 ) { $ x = ( $ l1 != $ l2 ) ? min ( $ l1 , $ l2 ) : -1 ; $ y = ( $ r1 != $ r2 ) ? max ( $ r1 , $ r2 ) : -1 ; echo $ x , " " , $ y ; } $ l1 = 5 ; $ r1 = 10 ; $ l2 = 1 ; $ r2 = 7 ; findPoints ( $ l1 , $ r1 , $ l2 , $ r2 ) ; ? >