Created
May 18, 2012 14:26
-
-
Save rrezzik/2725529 to your computer and use it in GitHub Desktop.
Using json_encode to go from PHP array to JSON
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 | |
| // Your PHP array | |
| $my_array = array('array' => array('a', 'b', 'c')); | |
| // Use json_encode to produce JSON | |
| $json_string = json_encode($my_array); | |
| // And let's see it! | |
| echo $json_string . "\n"; | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment