Last active
December 18, 2015 10:09
-
-
Save reconbot/5766653 to your computer and use it in GitHub Desktop.
example php array to json
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
<?php | |
$foo = Array(); | |
$foo["ewe"] = "Bob!\nHow are you?"; | |
$foo[4] = 5; | |
$foo["break"] = "</script>"; | |
# omg use templates | |
echo "<script>\n"; | |
echo "var globals = ", json_encode($foo), ";\n"; | |
echo "</script>\n\n"; | |
echo var_dump($foo); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment