Last active
December 13, 2018 02:23
-
-
Save hackvan/6db83f74d3563b091df8c7f936e5f11e to your computer and use it in GitHub Desktop.
Metaproggraming Examples
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
| s = "<php \n" | |
| s += " $x = 0; \n" | |
| for i in range(3): | |
| s += " $x = $x + %s; \n" % str(i+1) | |
| s += " print($x);\n ?>" | |
| open('dummy.php', 'w').write(s) |
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 | |
| $x = 0; | |
| $x = $x + 1; | |
| $x = $x + 2; | |
| $x = $x + 3; | |
| print($x); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment