I've long used a simple PHP script that tells me if a visitor is using Windows, Apple or Linux...

Code:
switch(PHP_OS)
{
 case 'Linux':
 break;
 case 'Darwin':
 require_once("Whatever.php");
 break;
 default:
 require_once("Whatever.php");
 break;
}
After starting to learn about designing for mobile devices, I discovered mobile queries, which let you target computers (screen) or mobile devices (handheld) with CSS styles.

Now I'd like to know if there's a PHP script similar to the one above that detects users' devices, distinguishing between computers, tablets and handhelds.

Until I get the hang of mobile design, I want to continue using my existing files for computer users, so I need a script that will let me include separate files for computers (screen) and handhelds.

Thanks!