How to detect mobile devices via PHP

Mobile Detect (http://mobiledetect.net/) is a very lightweight PHP class for detecting mobile devices. It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment and it’s very straightforward to implement.

First you need to download, include and instantiate the class.

Then you can detect the device: