- var_dump: documentation ( source)
- preg_match: documentation ( source)
- explode: documentation ( source)
<?php
$agent = "Mozilla/5.0 (iPad; CPU OS 10_3_2 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) CriOS/59.0.3071.102 Mobile/14F89 Safari/602.1";
echo 'v3.6.5 ';
preg_match('|CriOS[/ ]([0-9.]+)|', $agent, $version);
var_dump($version);
list ($majorVersion, $minorVersion) = explode('.', $version[1]);
echo 'v3.7.3 ';
preg_match('/Chrome[\/ ]([0-9.]+)|CrMo[\/ ]([0-9.]+)|CriOS[\/ ]([0-9.]+)/i', $agent, $version);
var_dump($version);
list ($majorVersion, $minorVersion) = explode('.', $version[1]);