Tuesday, November 16, 2010

PHP: Get the OS name


Share at Facebook

You can get the OS name at where the php script is running using system commands. At one of my php application, I was looking for the exact function. Not interested to use the system command. Below is what I have used that time.



$os_name = php_uname('s');
print $os_name;



The output will be "Windows NT" if you run this from your windows.




No comments: