fork download
  1. <?php
  2.  
  3. $data = '{"except_days":"","arrival_date":null,"from":null,"uid":"086B_0_2","title":"Минск — Киев","departure_date":null,"start_time":"22:40","number":"086Б","short_title":"Минск — Киев","days":"ежедневно, кроме 18.07, 27.09, 10.10","to":null,"carrier":{"code":114,"offices":[],"codes":{"icao":null,"sirena":null,"iata":null},"title":"Беларуская Чыгунка"},"transport_type":"train","stops":[{"arrival":null,"departure":"2018-07-28 22:40:00","terminal":null,"platform":"","station":{"code":"s9613989","station_type":"station","title":"Минск-Пасс.","popular_title":"","short_title":"","codes":{"yandex":"s9613989","esr":"140210"},"transport_type":"train","station_type_name":"станция","type":"station"},"stop_time":null,"duration":0.0},{"arrival":"2018-07-28 23:57:00","departure":"2018-07-29 00:01:00","terminal":null,"platform":"","station":{"code":"s9614258","station_type":"station","title":"Осиповичи-1","popular_title":"","short_title":"","codes":{"yandex":"s9614258","esr":"146407"},"transport_type":"train","station_type_name":"станция","type":"station"},"stop_time":240,"duration":4860.0},{"arrival":"2018-07-29 00:30:00","departure":"2018-07-29 00:33:00","terminal":null,"platform":"","station":{"code":"s9614101","station_type":"station","title":"Бобруйск","popular_title":"","short_title":"","codes":{"yandex":"s9614101","esr":"147008"},"transport_type":"train","station_type_name":"станция","type":"station"},"stop_time":180,"duration":6780.0},{"arrival":"2018-07-29 01:25:00","departure":"2018-07-29 01:28:00","terminal":null,"platform":"","station":{"code":"s9614068","station_type":"station","title":"Жлобин-Пасс.","popular_title":"","short_title":"","codes":{"yandex":"s9614068","esr":"155004"},"transport_type":"train","station_type_name":"станция","type":"station"},"stop_time":180,"duration":10080.0},{"arrival":"2018-07-29 02:45:00","departure":"2018-07-29 03:09:00","terminal":null,"platform":"","station":{"code":"s9614088","station_type":"station","title":"Гомель-Пасс.","popular_title":"","short_title":"","codes":{"yandex":"s9614088","esr":"150000"},"transport_type":"train","station_type_name":"станция","type":"station"},"stop_time":1440,"duration":16140.0},{"arrival":"2018-07-29 03:45:00","departure":"2018-07-29 04:24:00","terminal":null,"platform":"","station":{"code":"s9614894","station_type":"station","title":"Терюха","popular_title":null,"short_title":null,"codes":{"yandex":"s9614894","esr":"150301"},"transport_type":"train","station_type_name":"станция","type":"station"},"stop_time":2340,"duration":20640.0},{"arrival":"2018-07-29 08:56:00","departure":null,"terminal":null,"platform":"","station":{"code":"s9614928","station_type":"station","title":"Киев-Пасс.","popular_title":"","short_title":"","codes":{"yandex":"s9614928","esr":"320308"},"transport_type":"train","station_type_name":"станция","type":"station"},"stop_time":null,"duration":36960.0}],"vehicle":null,"start_date":"2018-07-28","transport_subtype":{"color":null,"code":null,"title":null},"express_type":null}';
  4. $data = json_decode($data);
  5. var_dump($data->number);
  6. echo PHP_EOL, PHP_EOL, PHP_EOL;
  7. foreach($data as $key => $value) {
  8. echo "$key = ";
  9. if(is_array($value) || is_object($value)) {
  10. print_r($value);
  11. }
  12. else {
  13. echo $value;
  14. }
  15. echo PHP_EOL;
  16. }
Success #stdin #stdout 0.01s 23660KB
stdin
Standard input is empty
stdout
string(5) "086Б"



except_days = 
arrival_date = 
from = 
uid = 086B_0_2
title = Минск — Киев
departure_date = 
start_time = 22:40
number = 086Б
short_title = Минск — Киев
days = ежедневно, кроме 18.07, 27.09, 10.10
to = 
carrier = stdClass Object
(
    [code] => 114
    [offices] => Array
        (
        )

    [codes] => stdClass Object
        (
            [icao] => 
            [sirena] => 
            [iata] => 
        )

    [title] => Беларуская Чыгунка
)

transport_type = train
stops = Array
(
    [0] => stdClass Object
        (
            [arrival] => 
            [departure] => 2018-07-28 22:40:00
            [terminal] => 
            [platform] => 
            [station] => stdClass Object
                (
                    [code] => s9613989
                    [station_type] => station
                    [title] => Минск-Пасс.
                    [popular_title] => 
                    [short_title] => 
                    [codes] => stdClass Object
                        (
                            [yandex] => s9613989
                            [esr] => 140210
                        )

                    [transport_type] => train
                    [station_type_name] => станция
                    [type] => station
                )

            [stop_time] => 
            [duration] => 0
        )

    [1] => stdClass Object
        (
            [arrival] => 2018-07-28 23:57:00
            [departure] => 2018-07-29 00:01:00
            [terminal] => 
            [platform] => 
            [station] => stdClass Object
                (
                    [code] => s9614258
                    [station_type] => station
                    [title] => Осиповичи-1
                    [popular_title] => 
                    [short_title] => 
                    [codes] => stdClass Object
                        (
                            [yandex] => s9614258
                            [esr] => 146407
                        )

                    [transport_type] => train
                    [station_type_name] => станция
                    [type] => station
                )

            [stop_time] => 240
            [duration] => 4860
        )

    [2] => stdClass Object
        (
            [arrival] => 2018-07-29 00:30:00
            [departure] => 2018-07-29 00:33:00
            [terminal] => 
            [platform] => 
            [station] => stdClass Object
                (
                    [code] => s9614101
                    [station_type] => station
                    [title] => Бобруйск
                    [popular_title] => 
                    [short_title] => 
                    [codes] => stdClass Object
                        (
                            [yandex] => s9614101
                            [esr] => 147008
                        )

                    [transport_type] => train
                    [station_type_name] => станция
                    [type] => station
                )

            [stop_time] => 180
            [duration] => 6780
        )

    [3] => stdClass Object
        (
            [arrival] => 2018-07-29 01:25:00
            [departure] => 2018-07-29 01:28:00
            [terminal] => 
            [platform] => 
            [station] => stdClass Object
                (
                    [code] => s9614068
                    [station_type] => station
                    [title] => Жлобин-Пасс.
                    [popular_title] => 
                    [short_title] => 
                    [codes] => stdClass Object
                        (
                            [yandex] => s9614068
                            [esr] => 155004
                        )

                    [transport_type] => train
                    [station_type_name] => станция
                    [type] => station
                )

            [stop_time] => 180
            [duration] => 10080
        )

    [4] => stdClass Object
        (
            [arrival] => 2018-07-29 02:45:00
            [departure] => 2018-07-29 03:09:00
            [terminal] => 
            [platform] => 
            [station] => stdClass Object
                (
                    [code] => s9614088
                    [station_type] => station
                    [title] => Гомель-Пасс.
                    [popular_title] => 
                    [short_title] => 
                    [codes] => stdClass Object
                        (
                            [yandex] => s9614088
                            [esr] => 150000
                        )

                    [transport_type] => train
                    [station_type_name] => станция
                    [type] => station
                )

            [stop_time] => 1440
            [duration] => 16140
        )

    [5] => stdClass Object
        (
            [arrival] => 2018-07-29 03:45:00
            [departure] => 2018-07-29 04:24:00
            [terminal] => 
            [platform] => 
            [station] => stdClass Object
                (
                    [code] => s9614894
                    [station_type] => station
                    [title] => Терюха
                    [popular_title] => 
                    [short_title] => 
                    [codes] => stdClass Object
                        (
                            [yandex] => s9614894
                            [esr] => 150301
                        )

                    [transport_type] => train
                    [station_type_name] => станция
                    [type] => station
                )

            [stop_time] => 2340
            [duration] => 20640
        )

    [6] => stdClass Object
        (
            [arrival] => 2018-07-29 08:56:00
            [departure] => 
            [terminal] => 
            [platform] => 
            [station] => stdClass Object
                (
                    [code] => s9614928
                    [station_type] => station
                    [title] => Киев-Пасс.
                    [popular_title] => 
                    [short_title] => 
                    [codes] => stdClass Object
                        (
                            [yandex] => s9614928
                            [esr] => 320308
                        )

                    [transport_type] => train
                    [station_type_name] => станция
                    [type] => station
                )

            [stop_time] => 
            [duration] => 36960
        )

)

vehicle = 
start_date = 2018-07-28
transport_subtype = stdClass Object
(
    [color] => 
    [code] => 
    [title] => 
)

express_type =