Advertisement
jiue123

Check Version IE

Nov 11th, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.33 KB | None | 0 0
  1. preg_match('/MSIE (.*?);/', $_SERVER['HTTP_USER_AGENT'], $matches);
  2.  
  3. if (count($matches)>1){
  4.   //Then we're using IE
  5.   $version = $matches[1];
  6.  
  7.   switch(true){
  8.     case ($version<=8):
  9.       //IE 8 or under!
  10.       break;
  11.  
  12.     case ($version==9):
  13.       //IE9!
  14.       break;
  15.  
  16.     default:
  17.       //You get the idea
  18.   }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement