Description
string
php_uname ( void )
php_uname() returns a string with a
description of the operating system PHP is built on. If you're just
wanting the name of the operating system, consider using the
PHP_OS constant.
Example 1. Some php_uname() examples |
<?php
echo php_uname();
echo PHP_OS;
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
echo 'This is a server using Windows!';
} else {
echo 'This is a server not using Windows!';
}
?>
|
|
There are also some related
Predefined PHP
constants that may come in handy, for example:
Example 2. A few OS related constant examples |
<?php
echo DIRECTORY_SEPARATOR; echo PHP_SHLIB_SUFFIX; echo PATH_SEPARATOR; echo DIRECTORY_SEPARATOR; echo PHP_SHLIB_SUFFIX; echo PATH_SEPARATOR; ?>
|
|
See also phpversion(),
php_sapi_name(), and
phpinfo().