From 7491aa5890c669db2a567e0024f820814a058f04 Mon Sep 17 00:00:00 2001 From: invisible73 Date: Thu, 6 Apr 2017 17:33:16 +0300 Subject: [PATCH] Create 01_binary_search.php (#13) --- .../php/01_binary_search.php | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 01_introduction_to_algorithms/php/01_binary_search.php diff --git a/01_introduction_to_algorithms/php/01_binary_search.php b/01_introduction_to_algorithms/php/01_binary_search.php new file mode 100644 index 0000000..1d76ddd --- /dev/null +++ b/01_introduction_to_algorithms/php/01_binary_search.php @@ -0,0 +1,26 @@ + $needle) { + $high = $middle - 1; + } else { + $low = $middle + 1; + } + } + + return null; +} + +$array = [1, 3, 5, 7, 9]; +echo binarySearch(3, $array) . "\n"; +echo binarySearch(-1, $array) . "\n";