0

I try to get $price, but something wrong. I think that 2016-04-16 can't be read. But I don't know how to fix it.

Here is result:

Array
(
    [success] => 1
    [data] => Array
        (
            [2016-04-16] => Array
                (
                    [name] => Nickola
                    [tag] => old
                    [price] => 206
                )

        )

)

Here is php:

<?php
    $wall = file_get_contents("XXX"); //request info
    $wall = json_decode ($wall, true); // convert JSON-string to array
    echo '<pre>'; print_r($wall); echo '</pre>'; //print array to check it OK.
    $wall = $wall->data->2016-04-16; // getting array with value I need
    for ($i = 0; $i < count($wall); $i++) {
    echo $wall[$i]->price; // print
    }
    ?>
halfer
  • 19,824
  • 17
  • 99
  • 186
Nes
  • 13
  • 2

0 Answers0