public static function filterByKeys(array $elements, $predicate)
    {
        $allowedKeys = array_filter(array_keys($elements), $predicate);
        return self::filterByAllowedKeys($elements, $allowedKeys);
    }
public static function filterByKeys(array $elements, $predicate)
    {
        $allowedKeys = array_filter(array_keys($elements), $predicate);
        return self::filterByAllowedKeys($elements, $allowedKeys);
    }
public static function filterByKeys ( array $ elements , $ predicate ) { $ allowedKeys = array_filter ( array_keys ( $ elements ) , $ predicate ) ; return self :: filterByAllowedKeys ( $ elements , $ allowedKeys ) ; }
Filters array by keys using the predicate.

Example:
<code>
$array = array('a1' => 1, 'a2' => 2, 'c' => 3);
$filtered = Arrays::filterByKeys($array, function ($elem) {
return $elem[0] == 'a';
});
</code>
Result:
<code>
Array
(
[a1] => 1
[b2] => 2
)
</code>

@param array $elements
@param callable $predicate
@return array
Filters array by keys using the predicate .