Program to compare two fractions | Get max of the two fractions ; Declare nume1 and nume2 for get the value of first numerator and second numerator ; Compute ad - bc ; Driver Code
< ? php function maxFraction ( $ first , $ sec ) { $ a = $ first [ 0 ] ; $ b = $ first [ 1 ] ; $ c = $ sec [ 0 ] ; $ d = $ sec [ 1 ] ; $ Y = $ a * $ d - $ b * $ c ; return ( $ Y ) ? $ first : $ sec ; } $ first = array ( 3 , 2 ) ; $ sec = array ( 3 , 4 ) ; $ res = maxFraction ( $ first , $ sec ) ; echo $ res [ 0 ] . " / " . $ res [ 1 ] ; ? >