Detect iPad and iPhone with PHP


Posted by Andrew McCombe on Wed Jul 25, 2012

If you ever have the need to detect iPad and iPhone with PHP, or any other mobile/tablet device, you can use the excellent php-mobile-detect library available at http://code.google.com/p/php-mobile-detect/.

Example usage:

If you want to detect mobile devices but not tablets you can use the following code snippet: