Created
September 6, 2016 16:49
-
-
Save dflima/886ddcf84115e39cffcd81043b142a60 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
use Illuminate\Support\Arr; | |
function array_multi_search(array $array, $key) | |
{ | |
if (!is_string($key)) { | |
return false; | |
} | |
$array = array_keys(Arr::dot($array)); | |
return array_reduce($array, function ($carry, $item) use ($key) { | |
return strpos($item, $key) || $carry; | |
}, false); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment