24 $userAgent = $_SERVER[
'HTTP_USER_AGENT'];
25 $browserName =
'Unknown';
29 foreach (self::BROWSERS as $k=>$name){
30 if(\preg_match(
"/$k/i",$userAgent)) {
37 $known = [
'Version', $ub,
'other'];
38 $pattern =
'#(?<browser>' . join(
'|', $known) .
')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#';
39 \preg_match_all($pattern, $userAgent, $matches);
41 $i = \count($matches[
'browser']);
43 if (\strripos($userAgent,
'Version') < \strripos($userAgent,$ub)){
44 $version= $matches[
'version'][0]??
null;
47 $version= $matches[
'version'][1]??
null;
51 $version= $matches[
'version'][0]??
null;
57 'userAgent' => $userAgent,
58 'name' => $browserName,
59 'version' => $version,
60 'platform' => $platform,