src/Tools.php
public static function getVersion(string $phrase, string $ua): string
    {
        $version = static::getVersionPattern($phrase);
        $uaString = str_replace(' NT', '', $ua);
        if (preg_match($version, $uaString)) {
            preg_match($version, $uaString, $v);
            $version = $v[0];
            $version = preg_replace('/' . $phrase . '/', '', $version);
            $version = str_replace(';', '', $version);
            $version = str_replace(' ', '', $version);
            $version = str_replace('/', '', $version);
            $version = str_replace('_', '.', $version);

            if(preg_match('/ Windows /', $uaString)) {
                $version = static::getWindowsVersion($version);
            }
            return $version;
        }
        return "not available";
    }
public static function getVersion(string $phrase, string $ua): string
    {
        $version = static::getVersionPattern($phrase);
        $uaString = str_replace(' NT', '', $ua);
        if (preg_match($version, $uaString)) {
            preg_match($version, $uaString, $v);
            $version = $v[0];
            $version = preg_replace('/' . $phrase . '/', '', $version);
            $version = str_replace(';', '', $version);
            $version = str_replace(' ', '', $version);
            $version = str_replace('/', '', $version);
            $version = str_replace('_', '.', $version);

            if(preg_match('/ Windows /', $uaString)) {
                $version = static::getWindowsVersion($version);
            }
            return $version;
        }
        return "not available";
    }
public static function getVersion ( string $ phrase , string $ ua ) : string { $ version = static :: getVersionPattern ( $ phrase ) ; $ uaString = str_replace ( ' NT' , '' , $ ua ) ; if ( preg_match ( $ version , $ uaString ) ) { preg_match ( $ version , $ uaString , $ v ) ; $ version = $ v [ 0 ] ; $ version = preg_replace ( '/' . $ phrase . '/' , '' , $ version ) ; $ version = str_replace ( ';' , '' , $ version ) ; $ version = str_replace ( ' ' , '' , $ version ) ; $ version = str_replace ( '/' , '' , $ version ) ; $ version = str_replace ( '_' , '.' , $ version ) ; if ( preg_match ( '/ Windows /' , $ uaString ) ) { $ version = static :: getWindowsVersion ( $ version ) ; } return $ version ; } return "not available" ; }
Return version from UA string
@param string $phrase
@param string $ua
@return string
Return version from UA string