library/Haste/Util/Arrays.php
public static function filterByPrefixes(array $arrData = [], $arrPrefixes = [])
    {
        $arrExtract = [];

        if (!is_array($arrPrefixes) || empty($arrPrefixes))
        {
            return $arrData;
        }

        foreach ($arrData as $key => $value)
        {
            foreach ($arrPrefixes as $strPrefix)
            {
                if (\HeimrichHannot\Haste\Util\StringUtil::startsWith($key, $strPrefix))
                {
                    $arrExtract[$key] = $value;
                }
            }
        }

        return $arrExtract;
    }
public static function filterByPrefixes(array $arrData = [], $arrPrefixes = [])
    {
        $arrExtract = [];

        if (!is_array($arrPrefixes) || empty($arrPrefixes))
        {
            return $arrData;
        }

        foreach ($arrData as $key => $value)
        {
            foreach ($arrPrefixes as $strPrefix)
            {
                if (\HeimrichHannot\Haste\Util\StringUtil::startsWith($key, $strPrefix))
                {
                    $arrExtract[$key] = $value;
                }
            }
        }

        return $arrExtract;
    }
public static function filterByPrefixes ( array $ arrData = [ ] , $ arrPrefixes = [ ] ) { $ arrExtract = [ ] ; if ( ! is_array ( $ arrPrefixes ) || empty ( $ arrPrefixes ) ) { return $ arrData ; } foreach ( $ arrData as $ key => $ value ) { foreach ( $ arrPrefixes as $ strPrefix ) { if ( \ HeimrichHannot \ Haste \ Util \ StringUtil :: startsWith ( $ key , $ strPrefix ) ) { $ arrExtract [ $ key ] = $ value ; } } } return $ arrExtract ; }
Filter an Array by given prefixes

@param array $arrData
@param array $arrPrefixes

@return array the filtered array or $arrData if $strPrefix is empty
Filter an Array by given prefixes