protected function filterBrowserVersions(array $userAgent)
    {
        // Safari and Opera 10.00+ version number is not encoded "normally"
        if (in_array($userAgent['browser_name'], ['safari', 'opera']) && stripos($userAgent['string'], ' version/')) {
            $userAgent['browser_version'] = preg_replace('|.+ version/([0-9]+(?:\.[0-9]+)?).*|i', '$1', $userAgent['string']);

            return $userAgent;
        }

        return $userAgent;
    }
protected function filterBrowserVersions(array $userAgent)
    {
        // Safari and Opera 10.00+ version number is not encoded "normally"
        if (in_array($userAgent['browser_name'], ['safari', 'opera']) && stripos($userAgent['string'], ' version/')) {
            $userAgent['browser_version'] = preg_replace('|.+ version/([0-9]+(?:\.[0-9]+)?).*|i', '$1', $userAgent['string']);

            return $userAgent;
        }

        return $userAgent;
    }
protected function filterBrowserVersions ( array $ userAgent ) { // Safari and Opera 10.00+ version number is not encoded "normally" if ( in_array ( $ userAgent [ 'browser_name' ] , [ 'safari' , 'opera' ] ) && stripos ( $ userAgent [ 'string' ] , ' version/' ) ) { $ userAgent [ 'browser_version' ] = preg_replace ( '|.+ version/([0-9]+(?:\.[0-9]+)?).*|i' , '$1' , $ userAgent [ 'string' ] ) ; return $ userAgent ; } return $ userAgent ; }
Filters browser versions to increase accuracy.

@param array $userAgent The user agent information

@return array Returns the updated user agent information.
Filters browser versions to increase accuracy .