Created
September 9, 2016 23:32
-
-
Save henrytran9x/8b9c40c3ff77b690a6918194ae860576 to your computer and use it in GitHub Desktop.
Get keys array by pattern match , return array keys index
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 _array_filter_key($matches,array $array){ | |
$matchedKeys = preg_grep($matches, array_keys($array)); | |
return array_intersect_key($array, array_flip($matchedKeys)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment