alanx15a2 / php-binary-search
global function do binary search.
Installs: 10
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/alanx15a2/php-binary-search
Requires (Dev)
- phpunit/phpunit: ^11.1
This package is auto-updated.
Last update: 2026-01-06 10:44:33 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.