alanx15a2 / php-binary-search
global function do binary search.
v1.0.1
2024-05-06 07:09 UTC
Requires (Dev)
- phpunit/phpunit: ^11.1
This package is auto-updated.
Last update: 2025-06-06 09:31:51 UTC
README
Installation
To install the PHP Binary Search package, simply use Composer:
composer require alanx15a2/php-binary-search
Useage example
Important Note: Binary search can only be performed on a SORTED ARRAY!
array_search_binary($array, $target);
If the target element is found, the function will return the key of the element. Otherwise, it will return -1.