Unnamed
public text v1 · immutable<?php
$string = 'en-us,en;q=0.8,en-us;q=0.5,en;q=0.3';
preg_match_all("/^([a-z]{2})-([a-z]{2}).*,([a-z]{2})-([a-z]{2}).*,([a-z]{2})/",$string,$matches);
echo '<pre>';
echo htmlentities(print_r($matches,true),ENT_QUOTES);
echo '</pre>';
?>