Binary Search Using PHP - Code sample
This piece of code accepts a string of comma separated values (positive integers) and a search item. Uses binary search to determine if the search item exists in the provided list while at the same time printing to the screen how many tries have been used.