I don’t think it’s a good idea but this link may help you: http://mobiledetect.net/
// Include and instantiate the class.
require_once 'Mobile_Detect.php';
$detect = new Mobile_Detect;
// Any mobile device (phones or tablets).
if ( $detect->isMobile() ) {
}
Anyways, that will only detect if that’s a mobile device and probably which one, I believe you’re misunderstanding the concepts of php.
Try to find a way to use js or css.
1
solved How to i convert the website into mobile responsive with php [closed]