Skip to content

Instantly share code, notes, and snippets.

@alessandro-fazzi
Created January 31, 2014 11:25
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 alessandro-fazzi/8730352 to your computer and use it in GitHub Desktop.
Save alessandro-fazzi/8730352 to your computer and use it in GitHub Desktop.
Operative system detect PHP
<?php
$user_agent = getenv("HTTP_USER_AGENT");
if (strpos($user_agent, "Win") !== FALSE)
$os = "Windows";
else (strpos($user_agent, "Mac") !== FALSE)
$os = "Mac"
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment