Returns information about the operating system PHP is running on
Syntax
php_uname(string $mode = "a"): string
Parameters
mode
mode is a single character that defines what information is returned.
Character | Definition | Example |
---|---|---|
a | All modes in the sequence. Default. | "s n r v m" |
s | Operating system name | FreeBSD |
n | Host name | localhost.example.com |
r | Release name | 5.1.2-RELEASE |
v | Version information | Varies between operating systems |
m | Machine type | i386 |
Return
Returns the description, as a string.
Examples
1 · void
<? $return = php_uname(); echo $return; ?>
Linux localhost 2.4.21-0.13mdk #1 Fri Mar 14 15:08:06 EST 2003 i686
2 · mode · a
<? $mode = "a"; $return = php_uname($mode); echo $return; ?>
Linux localhost 2.4.21-0.13mdk #1 Fri Mar 14 15:08:06 EST 2003 i686
3 · mode · s
<? $mode = "s"; $return = php_uname($mode); echo $return; ?>
Linux
4 · mode · n
<? $mode = "n"; $return = php_uname($mode); echo $return; ?>
localhost
5 · mode · r
<? $mode = "r"; $return = php_uname($mode); echo $return; ?>
2.4.21-0.13mdk
6 · mode · v
<? $mode = "v"; $return = php_uname($mode); echo $return; ?>
#1 Fri Mar 14 15:08:06 EST 2003
7 · mode · m
<? $mode = "m"; $return = php_uname($mode); echo $return; ?>
i686
8 · Constants
<? echo PHP_OS . PHP_EOL; echo DIRECTORY_SEPARATOR . PHP_EOL; echo PHP_SHLIB_SUFFIX . PHP_EOL; echo PATH_SEPARATOR; ?>
Linux / so :