Last active
May 6, 2020 19:31
-
-
Save masterfermin02/6d26d3fbde2a6e1695382b9bf04dc728 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 | |
function searchMultiDimensionalArray($array, $key, $value) { | |
if(!is_array($array)) { | |
return preg_match("/$value/i", $array); | |
} | |
return array_filter($array, function($item) use ($key, $value){ | |
return (isset($item[$key]) && !is_array($item[$key]) && preg_match("/$value/i", $item[$key])) | |
|| searchMultiDimensionalArray($item, $key, $value); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment