note 112550 deleted from reserved.constants by ajf
| From: | ajf@php.net | Date: | Fri, 01 Aug 2014 13:59:09 +0000 |
| Subject: | note 112550 deleted from reserved.constants by ajf | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-200082@lists.php.net to get a copy of this message | ||
Note Submitter: Volker
----
simple check for current OS:
<?php
class System {
const OS_UNKNWON = 1;
const OS_WIN = 2;
const OS_LINUX = 3;
const OS_OSX = 4;
/**
* @return int
*/
static public function getOS() {
switch (true) {
case stristr(PHP_OS, 'WIN'): return self::OS_WIN;
case stristr(PHP_OS, 'DAR'): return self::OS_OSX;
case stristr(PHP_OS, 'LINUX'): return self::OS_LINUX;
default : return self::OS_UNKNWON;
}
}
}
?>