To get the system platform in PHP, you can use the php_uname
function. This function returns a description of the operating system PHP is running on. Here's an example:
main.php41 chars3 lines
This will output a string with information about the operating system, including the OS name, version, and architecture.
If you want to get specific information about the operating system, such as the OS name or version, you can use the PHP_OS
constant or the posix_uname
function. Here's an example that uses PHP_OS
:
main.php104 chars6 lines
This will output either "Windows" or "Unix-based", depending on the operating system PHP is running on.
gistlibby LogSnag