text: Middle of three using minimum comparisons | PHP program to find middle of three distinct numbers ; Function to find the middle of three number ; Checking for b ; Checking for a ; Driver Code
code: < ? php function middleOfThree ( $ a , $ b , $ c ) { function middleOfThree ( $ a , $ b , $ c ) { if ( ( $ a < $ b && $ b < $ c ) or ( $ c < $ b && $ b < $ a ) ) return $ b ; else if ( ( $ b < $ a and $ a < $ c ) or ( $ c < $ a and $ a < $ b ) ) return $ a ; else return $ c ; } $ a = 20 ; $ b = 30 ; $ c = 40 ; echo middleOfThree ( $ a , $ b , $ c ) ; ? >