Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [XML][PHP]Szybka i sprawna metoda do obrobienia ARRAY
designez
post
Post #1





Grupa: Zarejestrowani
Postów: 77
Pomógł: 0
Dołączył: 11.08.2012

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


Witam, muszę kiedyś podciągnąć swoje umiejętności w php ale dziś niestety nie jest ten dzień i proszę o wskazówki jak najlepiej obrobić ARRAY który zwraca takie wartosci.

  1. Array ( [city] => Array ( [id] => 3089392 [name] => Olsztyn [coord] => Array ( [lon] => 19.659321 [lat] => 54.0616 ) [country] => PL [population] => 0 ) [cod] => 200 [message] => 0.3847 [cnt] => 7 [list] => Array ( [0] => Array ( [dt] => 1479376800 [temp] => Array ( [day] => 7.39 [min] => 7 [max] => 7.39 [night] => 7 [eve] => 7.39 [morn] => 7.39 ) [pressure] => 1004.98 [humidity] => 96 [weather] => Array ( [0] => Array ( [id] => 500 [main] => Rain [description] => light rain [icon] => 10d ) ) [speed] => 7.92 [deg] => 208 [clouds] => 92 [rain] => 1.29 ) [1] => Array ( [dt] => 1479463200 [temp] => Array ( [day] => 7.96 [min] => 6.99 [max] => 9.57 [night] => 9.45 [eve] => 9.28 [morn] => 6.99 ) [pressure] => 1005.36 [humidity] => 94 [weather] => Array ( [0] => Array ( [id] => 500 [main] => Rain [description] => light rain [icon] => 10d ) ) [speed] => 9.23 [deg] => 200 [clouds] => 92 [rain] => 0.38 ) [2] => Array ( [dt] => 1479549600 [temp] => Array ( [day] => 8.48 [min] => 7.66 [max] => 9.57 [night] => 7.66 [eve] => 8.56 [morn] => 7.71 ) [pressure] => 1011.83 [humidity] => 96 [weather] => Array ( [0] => Array ( [id] => 501 [main] => Rain [description] => moderate rain [icon] => 10d ) ) [speed] => 4.48 [deg] => 196 [clouds] => 92 [rain] => 6.17 ) [3] => Array ( [dt] => 1479636000 [temp] => Array ( [day] => 8.1 [min] => 6.92 [max] => 8.85 [night] => 8.85 [eve] => 7.77 [morn] => 7.52 ) [pressure] => 1014.42 [humidity] => 96 [weather] => Array ( [0] => Array ( [id] => 500 [main] => Rain [description] => light rain [icon] => 10d ) ) [speed] => 5.94 [deg] => 195 [clouds] => 36 ) [4] => Array ( [dt] => 1479722400 [temp] => Array ( [day] => 11.33 [min] => 8.15 [max] => 11.33 [night] => 9.11 [eve] => 10.63 [morn] => 8.15 ) [pressure] => 1014.84 [humidity] => 0 [weather] => Array ( [0] => Array ( [id] => 500 [main] => Rain [description] => light rain [icon] => 10d ) ) [speed] => 7.2 [deg] => 160 [clouds] => 18 [rain] => 0.23 ) [5] => Array ( [dt] => 1479808800 [temp] => Array ( [day] => 11.78 [min] => 7.51 [max] => 11.78 [night] => 7.51 [eve] => 8.94 [morn] => 8.15 ) [pressure] => 1021.38 [humidity] => 0 [weather] => Array ( [0] => Array ( [id] => 800 [main] => Clear [description] => clear sky [icon] => 01d ) ) [speed] => 5.28 [deg] => 190 [clouds] => 17 ) [6] => Array ( [dt] => 1479895200 [temp] => Array ( [day] => 8.96 [min] => 4.09 [max] => 8.96 [night] => 4.09 [eve] => 7.66 [morn] => 6.34 ) [pressure] => 1024.09 [humidity] => 0 [weather] => Array ( [0] => Array ( [id] => 500 [main] => Rain [description] => light rain [icon] => 10d ) ) [speed] => 5.58 [deg] => 249 [clouds] => 78 [rain] => 1.15 ) ) ) Max temperature for day 0 will be 7.39


Chcę wyświetlić część wartości na mojej aplikacji SmartHome (PHP, HTML) jak to ugryźć.

Pozdrawiam
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
designez
post
Post #2





Grupa: Zarejestrowani
Postów: 77
Pomógł: 0
Dołączył: 11.08.2012

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


  1. echo $data['city']['name'];
  2. echo "<br>";
  3. echo $data['city']['lon']['0']['dt']['day'];
  4. echo "<br>";
  5. echo $data['city']['temp']['day']['min'];
  6. echo "<br>";
  7. echo $data['city']['coord']['list']['0']['dt']['temp']['day'];
  8. echo "<br>";
  9. echo "<br>";
  10. echo $data['city']['coord'];


Kilka kombinacji nic z tego nie działa poza pierwszą linią.
Wybaczcie ale nie rozumiem Array staram się opanować zbyt dużo języków programowania na raz ale zawsze tablice nie były moją mocną stroną.

Ten post edytował designez 18.11.2016, 22:25:45
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 28.12.2025 - 02:03