Source Code:
(back to article)
<?php $json = '{"name":"John", "age":30, "city":"New York"}'; // decode the JSON data into an associative array $array = json_decode($json, true); // access the array elements echo $array['name'] . PHP_EOL; // John echo $array['age'] . PHP_EOL; // 30 echo $array['city']; // New York
Result:
Report an issue