Search code examples
phphtmlmobiletabletresponsive-design

How to detect between mobile & tablets in PHP


I read on this thread: Simplest way to detect a mobile device on how to know if the browser is a mobile device. the general code is this:

<?php include("Mobile_Detect.php"); include("demoData.php");
$detectIsMobile = new Mobile_Detect(); ?>

The problem is that I want to treat tablets (iPad & xoom).

I saw there that there is a isIpad() function that I have tested yet - but that still doesn't solve the difference between tablets and mobile phones.

Any idea?

thanks, Alon


Solution

  • Use

    <?php
        if($detect->isTablet()){
            // any tablet
        }
    ?>
    

    You can refer this page for more info http://code.google.com/p/php-mobile-detect/