alanx15a2/php-binary-search

global function do binary search.

Maintainers

Package info

github.com/alanx15a2/php-binary-search

pkg:composer/alanx15a2/php-binary-search

Statistics

Installs: 10

Dependents: 0

Suggesters: 0

Stars: 2

Open Issues: 0

v1.0.1 2024-05-06 07:09 UTC

This package is auto-updated.

Last update: 2026-04-06 11:26:06 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.