Skip to content

Instantly share code, notes, and snippets.

@dhrrgn
Created June 19, 2013 19:47
Show Gist options
  • Save dhrrgn/5817420 to your computer and use it in GitHub Desktop.
Save dhrrgn/5817420 to your computer and use it in GitHub Desktop.
preg_grep_keys() allows you to grep over the keys of an array.
<?php
function preg_grep_keys($pattern, $input) {
return preg_grep($pattern, array_keys($input));
}
@warent
Copy link

warent commented Apr 9, 2016

10/10 confirmed best function; using for production scale application

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment