AlexWebDevelop

Untitled

Jan 25th, 2021 (edited)
349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.37 KB | None | 0 0
  1. $json =
  2. '
  3. {
  4.     "Albums":
  5.     [
  6.         {
  7.             "Title": "Aqualung",
  8.             "Artist": "Jethro Tull"
  9.         },
  10.         {
  11.             "Title": "Thick as a Brick",
  12.             "Artist": "Jethro Tull"
  13.         }
  14.     ]
  15. }
  16. ';
  17.  
  18. $jsonData = json_decode($json);
  19.  
  20. foreach ($jsonData->Albums as $album)
  21. {
  22.   echo 'Album title: ' . $album->Title . '<br>';
  23.   echo 'Album artist: ' . $album->Artist . '<br>';
  24.   echo '<br>';
  25. }
Add Comment
Please, Sign In to add comment