fork(3) download
  1. <?php
  2.  
  3. $amg = '{
  4. "friendslist": {
  5. "friends": [
  6. {
  7. "steamid": "76561197960265731",
  8. "relationship": "friend",
  9. "friend_since": 0
  10. },
  11. {
  12. "steamid": "76561197960265738",
  13. "relationship": "friend",
  14. "friend_since": 0
  15. },
  16. {
  17. "steamid": "76561197960265740",
  18. "relationship": "friend",
  19. "friend_since": 0
  20. },
  21. {
  22. "steamid": "76561197960265747",
  23. "relationship": "friend",
  24. "friend_since": 0
  25. }
  26. ]
  27. }
  28. }';
  29.  
  30. $decode = json_decode( $amg, FALSE );
  31. foreach ( $decode->friendslist->friends as $valor){
  32. echo 'Id:'.$valor->steamid.PHP_EOL;
  33. echo 'Rel.:'.$valor->relationship.PHP_EOL;
  34. echo PHP_EOL;
  35. }
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
Id:76561197960265731
Rel.:friend

Id:76561197960265738
Rel.:friend

Id:76561197960265740
Rel.:friend

Id:76561197960265747
Rel.:friend