Created
February 25, 2016 02:59
-
-
Save henrytran9x/8685df35bc4f4dbbdd8f to your computer and use it in GitHub Desktop.
Filter regex keys array
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