Binary search algorithm in PHP

Binary search is a search algorithm that is dramatically faster than PHP’s internal functions (such as array_search) when searching ordered data. How does it work? PHP’s internal function array_search is an example of a linear search; it will iterate over the entire data set until it finds a match working from front to back. This is great …

Continue reading