Voting

: zero plus five?
(Example: nine)

The Note You're Voting On

Daniel Klein
12 years ago
A shorter way to run a match on the array's keys rather than the values:

<?php
function preg_grep_keys($pattern, $input, $flags = 0) {
return
array_intersect_key($input, array_flip(preg_grep($pattern, array_keys($input), $flags)));
}
?>

<< Back to user notes page

To Top