Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP] Wyciąganie danych z tablicy
TheBill
post 4.05.2014, 06:31:27
Post #1





Grupa: Zarejestrowani
Postów: 14
Pomógł: 0
Dołączył: 28.04.2014

Ostrzeżenie: (0%)
-----


Witam
Czy ktoś mógłby mi udzielić wskazówki:

  1.  
  2. $response = Unirest::get("https://community-league-of-legends.p.mashape.com/api/v1.0/eune/summoner/retrieveInProgressSpectatorGameInfo/$summoner";
  3. //var_dump($response); // <a href="http://pastebin.com/cUTqBxpf" target="_blank">http://pastebin.com/cUTqBxpf</a>
  4.  
  5. foreach($response->body->game->playerChampionSelections->array as $selection){
  6. foreach($response->body->game->teamOne->array as $player){
  7. if($selection->summonerInternalName == $player->summonerInternalName){
  8. $chId = $selection->championId;
  9. $sp1Id = $selection->spell1Id;
  10. $sp2Id = $selection->spell2Id;
  11. $summName = $player->summonerName;
  12. $summID = $player->summonerId;
  13.  
  14. $summData = array ($summName1,$summID1,$chId1,$chId1,$sp2Id1);


Var_dump($summData):
Kod
array(5) { [0]=> string(16) "EpicBloodyHunter" [1]=> int(37070757) [2]=> int(61) [3]=> int(61) [4]=> int(14) } array(5) { [0]=> string(6) "jaclaw" [1]=> int(21641095) [2]=> int(35) [3]=> int(35) [4]=> int(11) } array(5) { [0]=> string(12) "Mighty Kowal" [1]=> int(35709368) [2]=> int(80) [3]=> int(80) [4]=> int(4) } array(5) { [0]=> string(6) "JuVVeX" [1]=> int(30440043) [2]=> int(143) [3]=> int(143) [4]=> int(3) } array(5) { [0]=> string(7) "XplayyX" [1]=> int(24500723) [2]=> int(236) [3]=> int(236) [4]=> int(7) }


Chciałbym uzyskać coś takiego :

$summoner0Name = EpicBloodyHunter
$summoner1Name = jaclaw
itd
...
$summoner0chId = 61
$summoner1chId = 35
...
$summoner0Id = 37070757
$summoner1Id = 21641095

Czy ktoś pomoże?
Go to the top of the page
+Quote Post
#luq
post 4.05.2014, 08:25:13
Post #2





Grupa: Zarejestrowani
Postów: 589
Pomógł: 91
Dołączył: 22.05.2008
Skąd: Gliwice

Ostrzeżenie: (0%)
-----


Prawdopodobnie, jeśli chcesz coś takiego zrobić to robisz coś źle smile.gif
Daj znać po co Ci to.

Zrealizujesz to używając zmiennej zmiennej w PHP. Zobacz


--------------------
Moja gra - scraby.io
Go to the top of the page
+Quote Post
TheBill
post 4.05.2014, 09:12:52
Post #3





Grupa: Zarejestrowani
Postów: 14
Pomógł: 0
Dołączył: 28.04.2014

Ostrzeżenie: (0%)
-----


Poradziłem sobie tworząc własne tablice.
Temat do zamknięcia.

Ten post edytował TheBill 4.05.2014, 22:28:15
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 29.03.2024 - 08:10