I am trying to do the following with PHP:
$user_agent = "Mozilla/5.0 (Linux; Android 4.4.2; SAMSUNG-GT-I9505 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.96 Mobile Safari/537.36"
if (preg_match('/android/i', $user_agent)) {
$version = preg_split('Android (.*?);', $user_agent); //regex should be `Android (.*?);` which would give me 4.4.2
}
But I do not really know how to get the code right, the part after $version is guesswork. anybody could help me out? Maybe with preg_split? I want 4.4.2 stored in $version.