Function to perform binary search on a particular column of the 2D array
function binarySearchColumnDec ( $ arr , $ col , $ t , $ b , $ x ) { while ( $ t <= $ b ) { $ mid = ( int ) ( ( $ t + $ b ) / 2 ) ; if ( $ arr [ $ mid ] [ $ col ] == $ x ) return $ mid ; if ( $ arr [ $ mid ] [ $ col ] < $ x ) $ b = $ mid - 1 ; else $ t = $ mid + 1 ; } return -1 ; }