When you create an array of $ a, also create an array of companions, unless numbers are keys and letters are values (e.g. $ _a = array (3 => 'a', 6 => 'y', 12 = > 'z');
Then you can do array_keys in this new array, for example. (3, 6, 12), sort them and go through until you find one that is larger than the one you are checking.
For an additional loan, rather than a search, linearly search for newton - start with the size ($ _ a) / 2; if it is too large, go to the size ($ _ a) * 3/4, otherwise the size ($ _ a) * 1/4
source share