Skip to content

Instantly share code, notes, and snippets.

@teitei-tk
Created May 1, 2015 01:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teitei-tk/187a36cf01d50f15be1e to your computer and use it in GitHub Desktop.
Save teitei-tk/187a36cf01d50f15be1e to your computer and use it in GitHub Desktop.
detect ios version number
<?php
$txt = 'Mozilla/5.0 (iPhone; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12F70 Safari/600.1.4';
$reg = '/iPhone OS ([0-9]+)_([0-9]+)/i';
preg_match($reg, $txt, $result);
$str_version = $result[1] . '.' . $result[2]; //This variable should now contain : 4.0
var_dump($result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment