function to find the lower bound
< ? php function lower_bound ( $ A , $ valueTosearch ) { $ row = 0 ; foreach ( $ A as $ key = > $ value ) { if ( $ valueTosearch <= $ value ) return $ row ; $ row ++ ; } return $ row + 1 ; }