Web Hosting Talk







View Full Version : [PHP] workout if system os is windows or linux


latheesan
06-06-2008, 09:23 PM
How do you workout if current system is windows or linux? I want to write a piece of code based on the operating system, for e.g:

if (windows)
{
// do this
}
else
{
// do the same thing as above, but suited for linux
}

Thanks in advance for any help/info.

latheesan
06-06-2008, 09:46 PM
nvm, i found it :

if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
echo 'This is a server using Windows!';
} else {
echo 'This is a server not using Windows!';
}