Created
September 29, 2016 03:50
-
-
Save foospidy/52adf3ccd7e9116f4849dbdf855072d8 to your computer and use it in GitHub Desktop.
Convert a string to a PHP array in the implode function.
This file contains 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
#!/usr/bin/python | |
# | |
# str2implode.py | |
# | |
# Usage: python str2implody.py "example string with spaces" | |
# | |
import sys | |
out = "" | |
for c in sys.argv[1]: | |
out = out + "chr(" + str(ord(c)) + ")," | |
print "implode(NULL, array(" + out + "))" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment