40 $rawHeader =
preg_replace(
'/^[-\w]+:\s*/',
'', $rawHeader );
47 preg_match_all(
'@([a-z\d*]+([-+/.][a-z\d*]+)*)\s*(;\s*q\s*=\s*(1(\.0{0,3})?|0(\.\d{0,3})?)?)?@',
48 $rawHeader, $value_parse );
50 if ( !count( $value_parse[1] ) ) {
54 $values = $value_parse[1];
55 $qvalues = $value_parse[4];
56 $indices =
range( 0, count( $value_parse[1] ) - 1 );
59 foreach ( $indices as $index ) {
60 if ( $qvalues[$index] ===
'' ) {
62 }
elseif ( $qvalues[$index] == 0 ) {
63 unset( $values[$index], $qvalues[$index], $indices[$index] );
65 $qvalues[$index] = (
float)$qvalues[$index];
70 array_multisort( $qvalues, SORT_DESC, SORT_NUMERIC, $indices, $values );