Skip to content

Instantly share code, notes, and snippets.

@iTrooz
Created December 4, 2023 21:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iTrooz/fa87b0a4e7bbfbb432c60d350012dd7e to your computer and use it in GitHub Desktop.
Save iTrooz/fa87b0a4e7bbfbb432c60d350012dd7e to your computer and use it in GitHub Desktop.
python preprocessor
<?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