I am here to ask about an script for getting user device i.e. Android or iOS or Web. I have tried something like but in android phone it showing Linux.
$agent = $_SERVER["HTTP_USER_AGENT"];
//print_r($agent);
if (preg_match('/Linux/', $agent))
$os = 'Linux';
elseif (preg_match('/Windows/', $agent))
$os = 'Windows';
elseif (preg_match('/Mac/', $agent))
$os = 'Mac';
elseif (preg_match('/Android/', $agent))
$os = 'Android';
elseif (preg_match('/Apple/', $agent))
$os = 'Apple';
else
$os = 'UnKnown';
echo $os;