Created
April 6, 2012 13:48
-
-
Save marczhermo/2319931 to your computer and use it in GitHub Desktop.
PHP: json_encode/decode
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 | |
$data = array('description' => "TEST: quick brown fox", | |
'public' => true, | |
'files' => array('gistfile.php' => array('content' => "the quick brown fox jumps over the lazy dog."))); | |
$data_string = json_encode($data); | |
echo '<pre>'.$data_string.'<p>'; | |
var_dump(json_decode('{ | |
"description": "the description for this gist", | |
"public": true, | |
"files": { | |
"file1.txt": { | |
"content": "String file contents" | |
} | |
} | |
}',TRUE)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment