I am using this preg_match string
preg_match(\'/Trident/7.0; rv:11.0/\',$_SERVER[\"HTTP_USER_AGENT\"]
to detect IE11 so I can
IE11 has touch versions and non-touch versions, this means that the Guilherme Sehn's answer will not work for touch devices.
if(strpos($_SERVER['HTTP_USER_AGENT'], 'Trident/7.0; rv:11.0') !== false)
Instead, use this:
if ( strpos($_SERVER['HTTP_USER_AGENT'], 'rv:11.0') !== false
&& strpos($_SERVER['HTTP_USER_AGENT'], 'Trident/7.0;')!== false)
{
echo "User is on IE11 touch / non-touch";
}
This is because any number of parameters could be added between "Trident" and the revision number.
Likewise if you want to check if they're on touch just do a strpos for "Touch;".