I downloaded the source code on how to detect mobile browser for detectmobilebrowser.com but they do not have any documentation and code is very cryptic.
I just want it to do this.
If it is a mobile browser then take the user to this site: http://fmdentalcentre.com/mobile
I tried modifying the source code but it does not work.

Code:
<?php
$useragent=$_SERVER['HTTP_USER_AGENT'];
if(preg_match('/(android|bb\d+|meego) 
...some code...
header('Location: http://www.fmdentalcentre.com/mobile');
?>