To get the system architecture in PHP, you can use the PHP_OS
constant and check for specific architecture values.
Here's an example code snippet:
main.php521 chars15 lines
This code snippet will output the system architecture based on the operating system. For Windows, it will output if it's 32-bit or 64-bit. For macOS, it will output 64-bit since all modern Macs are 64-bit. For Linux, it will execute the uname -m
command to get the machine hardware name and check if it's 64-bit or not.
gistlibby LogSnag