src/helpers/ArrayHelper.php
public static function filter_prefixed($array, $prefix, $removePrefix = true)
    {
        $return =[];
        foreach ($array as $key => $val) {
            if (preg_match('/^'.$prefix.'/', $key)) {
                if ($removePrefix === true) {
                    $key = preg_replace('/^'.$prefix.'/','',$key);
                }
                $return[$key] = $val;
            }
        }
        return $return;
    }
public static function filter_prefixed($array, $prefix, $removePrefix = true)
    {
        $return =[];
        foreach ($array as $key => $val) {
            if (preg_match('/^'.$prefix.'/', $key)) {
                if ($removePrefix === true) {
                    $key = preg_replace('/^'.$prefix.'/','',$key);
                }
                $return[$key] = $val;
            }
        }
        return $return;
    }
public static function filter_prefixed ( $ array , $ prefix , $ removePrefix = true ) { $ return = [ ] ; foreach ( $ array as $ key => $ val ) { if ( preg_match ( '/^' . $ prefix . '/' , $ key ) ) { if ( $ removePrefix === true ) { $ key = preg_replace ( '/^' . $ prefix . '/' , '' , $ key ) ; } $ return [ $ key ] = $ val ; } } return $ return ; }
Filters an array on prefixed associative keys.
@param   array   $array        the array to filter.
@param   string  $prefix       prefix to filter on.
@param   bool    $removePrefix whether to remove the prefix.
@return  array
Filters an array on prefixed associative keys .