@jamietrent
I think this is the translation:
preg_match_all('/([a-z]{1,2})(-([a-z0-9]+))?(;q=([0-9\.]+))?/', $lang, $found);
Maybe take it for a spin? I had to do this once to drupal to get it to run on my server, and this was the solution, I think.
The functions are similar, except on the pattern, add a "/" char at the beginning and the end.