Simple PHP Script To Detect The Current Platform

$uname = php_uname('s');

if (stripos($uname, 'win') === 0) {
    // Platform is Windows.
}
else if (stripos($uname, 'darwin') === 0) {
    // Platform is OSx.
}
else if (stripos($uname, 'linux') === 0) {
    // Platform is Linux.
}

 

Add new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
5 + 5 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.