This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @param string $value The value you're searching for | |
* @param array $dataSet Your sorted data set to search | |
* | |
* @return int Returns the key matched, or -1 if no match is found | |
*/ | |
function binarySearchString(string $value, array $dataSet): int | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Search an array recursively looking for a key containing the supplied $search_string | |
* | |
* array_ksearch() is case-sensitive, where as array_kisearch() is case-insensitive | |
* | |
* Returns an array containing all matched key(s) and their associated value(s), or an empty array upon no matches | |
* | |
* @param array $array |