René's URL Explorer Experiment


Title: Binary Search in PHP - Runnable Code Snippet

Open Graph Title: Binary Search in PHP - Runnable Code Snippet

X Title: Binary Search in PHP - Runnable Code Snippet

Description: Find the index of an element in a sorted array using binary search with O(log n) time complexity. Runnable PHP snippet with live execution.

Open Graph Description: Find the index of an element in a sorted array using binary search with O(log n) time complexity. Runnable PHP snippet with live execution.

X Description: Find the index of an element in a sorted array using binary search with O(log n) time complexity. Runnable PHP snippet with live execution.

Keywords:

Opengraph URL: https://tempercode.dev/snippets/binary-search-php

direct link

Domain: tempercode.dev


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"SoftwareSourceCode","name":"Binary Search","description":"Find the index of an element in a sorted array using binary search with O(log n) time complexity.","programmingLanguage":"PHP","text":"$lo = 0; $hi = count($arr) - 1; $result = -1;\nwhile ($lo <= $hi) {\n    $mid = intdiv($lo + $hi, 2);\n    if ($arr[$mid] === $target) { $result = $mid; break; }\n    elseif ($arr[$mid] < $target) $lo = $mid + 1;\n    else $hi = $mid - 1;\n}\n$result;"}

theme-color#0c0d12
color-schemedark
authorTemper
creatorTemper
publisherTemper
og:imagehttps://tempercode.dev/og-image.png
og:typearticle
twitter:cardsummary_large_image
twitter:imagehttps://tempercode.dev/og-image.png

Links:

Temperhttps://tempercode.dev/snippets
Snippetshttps://tempercode.dev/snippets
Editorhttps://tempercode.dev/editor
CLIhttps://tempercode.dev/cli
https://github.com/handcraftbyte/temper-snippets
Snippetshttps://tempercode.dev/snippets
Editorhttps://tempercode.dev/editor
CLIhttps://tempercode.dev/cli
https://github.com/handcraftbyte/temper-snippets/blob/main/algorithms/binary-search-php.md
JavaScripthttps://tempercode.dev/snippets/binary-search-javascript
Pythonhttps://tempercode.dev/snippets/binary-search-python
Rubyhttps://tempercode.dev/snippets/binary-search-ruby
Bashhttps://tempercode.dev/snippets/binary-search-bash
Array DifferenceFind elements in the first array that are not present in the second array.https://tempercode.dev/snippets/array-difference-php
Array FrequenciesCount how many times each value appears in an array and return a frequency map.https://tempercode.dev/snippets/array-frequencies-php
Array HeadGet the first n elements of an array.https://tempercode.dev/snippets/array-head-php
Array IntersectionFind common elements that exist in both arrays.https://tempercode.dev/snippets/array-intersection-php
Array TailGet the last n elements of an array.https://tempercode.dev/snippets/array-tail-php
Array UnionCombine two arrays and remove duplicates to produce a union.https://tempercode.dev/snippets/array-union-php

Viewport: width=device-width, initial-scale=1


URLs of crawlers that visited me.