Skip to content

Instantly share code, notes, and snippets.

@reconbot
Last active December 18, 2015 10:09
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 reconbot/5766653 to your computer and use it in GitHub Desktop.
Save reconbot/5766653 to your computer and use it in GitHub Desktop.
example php array to json
<?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