Detecting OS in PHP

Simply

echo PHP_OS;

It will print:

For Mac: Darwin

For Windows Visat: WinNT

For Ubuntu: Linux

Also if you want to know OS details about users accessing your site, you can use

$_SERVER[‘HTTP_USER_AGENT’]


Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.