protected static function parse($string, $separator = null)
    {
        $items = [];
        if($string) {
            $string = strtolower(str_replace(' ', '', $string));
            $rows = explode(',', $string);
            foreach($rows as $row) {
                @list($item, $quality) = explode(';q=', $row);
                if(!$quality) {
                    if($separator) {
                        @list($part, $subpart) = explode($separator, $item);
                        $quality = ($part = '*' or $subpart == '*') ? 0 : 1;
                    }
                    else {
                        $quality = ($item == '*') ? 0 : 1;
                    }
                }
                $items[$item] = (float)$quality;
            }
            sort($items);
            $items = array_keys($items);
        }

        return $items;
    }
protected static function parse($string, $separator = null)
    {
        $items = [];
        if($string) {
            $string = strtolower(str_replace(' ', '', $string));
            $rows = explode(',', $string);
            foreach($rows as $row) {
                @list($item, $quality) = explode(';q=', $row);
                if(!$quality) {
                    if($separator) {
                        @list($part, $subpart) = explode($separator, $item);
                        $quality = ($part = '*' or $subpart == '*') ? 0 : 1;
                    }
                    else {
                        $quality = ($item == '*') ? 0 : 1;
                    }
                }
                $items[$item] = (float)$quality;
            }
            sort($items);
            $items = array_keys($items);
        }

        return $items;
    }
protected static function parse ( $ string , $ separator = null ) { $ items = [ ] ; if ( $ string ) { $ string = strtolower ( str_replace ( ' ' , '' , $ string ) ) ; $ rows = explode ( ',' , $ string ) ; foreach ( $ rows as $ row ) { @ list ( $ item , $ quality ) = explode ( ';q=' , $ row ) ; if ( ! $ quality ) { if ( $ separator ) { @ list ( $ part , $ subpart ) = explode ( $ separator , $ item ) ; $ quality = ( $ part = '*' or $ subpart == '*' ) ? 0 : 1 ; } else { $ quality = ( $ item == '*' ) ? 0 : 1 ; } } $ items [ $ item ] = ( float ) $ quality ; } sort ( $ items ) ; $ items = array_keys ( $ items ) ; } return $ items ; }
Accept string parsing

@param string $string
@param string $separator
@return array
Accept string parsing