Answer the question
In order to leave comments, you need to log in
How to output first and last line in JSON via PHP?
Hi all! Guys, help me implement the output, I can’t draw a conclusion (it turns out to only output in a loop, but all the directions from stops through json_decode)! It is necessary to output exactly two lines from json to php
, that is, the output of the value just in these lines
stops-> 0-> station-> code
stops-> 11-> station-> code
the output should be
s9734072
s9771828
{"except_days":"","arrival_date":null,"from":null,"uid":"empty_3_f9734072t9771828_86","title":"Жлобин — Отрубы","departure_date":null,"start_time":"05:00","number":"","short_title":"Жлобин — Отрубы","days":"пн","to":null,"carrier":null,"transport_type":"bus","stops":[{"arrival":null,"departure":"2018-09-24 05:00:00","terminal":null,"platform":"","station":{"code":"s9734072","station_type":"bus_station","title":"Жлобин","popular_title":"","short_title":"","codes":{"yandex":"s9734072"},"transport_type":"bus","station_type_name":"автовокзал","type":"station"},"stop_time":null,"duration":0.0},{"arrival":"2018-09-24 05:11:00","departure":"2018-09-24 05:12:00","terminal":null,"platform":"","station":{"code":"s9771537","station_type":"bus_stop","title":"Малые Роги","popular_title":null,"short_title":null,"codes":{"yandex":"s9771537"},"transport_type":"bus","station_type_name":"автобусная остановка","type":"station"},"stop_time":60,"duration":720.0},{"arrival":"2018-09-24 05:13:00","departure":"2018-09-24 05:14:00","terminal":null,"platform":"","station":{"code":"s9771538","station_type":"bus_stop","title":"Солоное","popular_title":null,"short_title":null,"codes":{"yandex":"s9771538"},"transport_type":"bus","station_type_name":"автобусная остановка","type":"station"},"stop_time":60,"duration":840.0},{"arrival":"2018-09-24 05:19:00","departure":"2018-09-24 05:20:00","terminal":null,"platform":"","station":{"code":"s9771539","station_type":"bus_stop","title":"Грабск","popular_title":null,"short_title":null,"codes":{"yandex":"s9771539"},"transport_type":"bus","station_type_name":"автобусная остановка","type":"station"},"stop_time":60,"duration":1200.0},{"arrival":"2018-09-24 05:27:00","departure":"2018-09-24 05:28:00","terminal":null,"platform":"","station":{"code":"s9771542","station_type":"bus_stop","title":"Папоротное","popular_title":null,"short_title":null,"codes":{"yandex":"s9771542"},"transport_type":"bus","station_type_name":"автобусная остановка","type":"station"},"stop_time":60,"duration":1680.0},{"arrival":"2018-09-24 05:33:00","departure":"2018-09-24 05:34:00","terminal":null,"platform":"","station":{"code":"s9771673","station_type":"bus_stop","title":"Возрождение","popular_title":null,"short_title":null,"codes":{"yandex":"s9771673"},"transport_type":"bus","station_type_name":"автобусная остановка","type":"station"},"stop_time":60,"duration":2040.0},{"arrival":"2018-09-24 05:37:00","departure":"2018-09-24 05:38:00","terminal":null,"platform":"","station":{"code":"s9771674","station_type":"bus_stop","title":"Гелин","popular_title":null,"short_title":null,"codes":{"yandex":"s9771674"},"transport_type":"bus","station_type_name":"автобусная остановка","type":"station"},"stop_time":60,"duration":2280.0},{"arrival":"2018-09-24 05:43:00","departure":"2018-09-24 05:44:00","terminal":null,"platform":"","station":{"code":"s9771675","station_type":"bus_stop","title":"Косаковка","popular_title":null,"short_title":null,"codes":{"yandex":"s9771675"},"transport_type":"bus","station_type_name":"автобусная остановка","type":"station"},"stop_time":60,"duration":2640.0},{"arrival":"2018-09-24 05:52:00","departure":"2018-09-24 05:53:00","terminal":null,"platform":"","station":{"code":"s9771676","station_type":"bus_stop","title":"Великий Лес","popular_title":"","short_title":"","codes":{"yandex":"s9771676"},"transport_type":"bus","station_type_name":"автобусная остановка","type":"station"},"stop_time":60,"duration":3180.0},{"arrival":"2018-09-24 06:03:00","departure":"2018-09-24 06:04:00","terminal":null,"platform":"","station":{"code":"s9771677","station_type":"bus_stop","title":"Кабановка","popular_title":null,"short_title":null,"codes":{"yandex":"s9771677"},"transport_type":"bus","station_type_name":"автобусная остановка","type":"station"},"stop_time":60,"duration":3840.0},{"arrival":"2018-09-24 06:11:00","departure":"2018-09-24 06:12:00","terminal":null,"platform":"","station":{"code":"s9771827","station_type":"bus_stop","title":"Ляды","popular_title":null,"short_title":null,"codes":{"yandex":"s9771827"},"transport_type":"bus","station_type_name":"автобусная остановка","type":"station"},"stop_time":60,"duration":4320.0},{"arrival":"2018-09-24 06:23:00","departure":null,"terminal":null,"platform":"","station":{"code":"s9771828","station_type":"bus_stop","title":"Отрубы","popular_title":null,"short_title":null,"codes":{"yandex":"s9771828"},"transport_type":"bus","station_type_name":"автобусная остановка","type":"station"},"stop_time":null,"duration":4980.0}],"vehicle":null,"start_date":"2018-09-24","transport_subtype":{"color":null,"code":null,"title":null},"express_type":null}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question