Created
August 3, 2014 19:18
-
-
Save fabiocerqueira/2959986b166fc75fbd08 to your computer and use it in GitHub Desktop.
Exemplo bizarro misturando as linguagens. Não faça isso em casa.
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 | |
| function python($code) { | |
| return shell_exec("python -c '$code'"); | |
| } | |
| $python_code = " | |
| def fat(n): | |
| if n == 0: | |
| return 1 | |
| else: | |
| return n * fat(n - 1) | |
| for i in range(5): | |
| print fat(i) | |
| "; | |
| echo python($python_code); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment