php_uname

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
:

assert

assert_options

cli_get_process_title

cli_set_process_title

dl

extension_loaded

gc_collect_cycles

gc_disable

gc_enable

gc_enabled

gc_mem_caches

gc_status

get_cfg_var

get_current_user

get_defined_constants

get_extension_funcs

get_include_path

get_included_files

get_loaded_extensions

get_required_files

get_resources

getenv

getlastmod

getmygid

getmyinode

getmypid

getmyuid

getopt

getrusage

ini_alter

ini_get

ini_get_all

ini_restore

ini_set

memory_get_peak_usage

memory_get_usage

memory_reset_peak_usage

php_ini_loaded_file

php_ini_scanned_files

php_sapi_name

phpcredits

phpinfo

phpversion

putenv

set_include_path

set_time_limit

sys_get_temp_dir

version_compare

zend_thread_id

zend_version

PHP

Home Menu