Advertisement
Fray117

Simple Detect OS

Jul 29th, 2018
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.23 KB | None | 0 0
  1. <?php
  2. // OS Detect Function
  3. function OS() {
  4.   if(strtoupper(substr(PHP_OS, 0, 3)) === "WIN") {
  5.     return "Windows";
  6.   } elseif(preg_match("/Darwin/", php_uname())) {
  7.     return "macOS";
  8.   } else {
  9.     return "Linux";
  10.   }
  11. }
  12. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement