Created
December 4, 2023 21:05
-
-
Save iTrooz/fa87b0a4e7bbfbb432c60d350012dd7e to your computer and use it in GitHub Desktop.
python preprocessor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php # The voice in my head told me to. Run with `php main.py.php | python` ?> | |
def getOS(): | |
<?php | |
if (PHP_OS == "Linux"){ | |
?> | |
for line in open("/etc/os-release"): | |
key, value = line.split("=") | |
if key == "ID": | |
distro_id = value | |
return f"I am on Linux. Precisely: {distro_id}" | |
<?php | |
}else if(PHP_OS == "Windows") { | |
?> | |
return "I am on Windows !" | |
<?php | |
} | |
?> | |
print(getOS()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment