Thanks dalecosp and Weedpacket. You pointed me in the right direction.
Or for Windows maybe use: $os = @shell_exec("ver");
<?PHP
//$os = @system("uname -s"); // Outputs to the browser
$os = @exec("uname -s"); // Doesn't output to the browser
echo '<br>OS returned is: ', $os, '<br>';
$compliant=array(
"Linux",
"FreeBSD",
"OpenBSD",
"NetBSD");
if (in_array($os, $compliant)) {
echo "Is Unix/Linux etc.";
}
else
if (is_dir("C:\\Windows")) {
echo "Is windows";
} else {
echo "Maybe Mac";
}
?>
On my server this outputs:
OS returned is: Linux
Is Unix/Linux etc.
Thank you all.