-2

I get the result in $list = json_decode($result, true); I tried to output via array_column but nothing comes out.

This is the array:

array(95) {
  [0]=>
  array(4) {
    ["next_episode"]=>
    int(1)
    ["next_episode_at"]=>
    string(29) "2021-04-01T09:00:00.000+03:00"
    ["duration"]=>
    NULL
    ["anime"]=>
    array(12) {
      ["id"]=>
      int(48442)
      ["name"]=>
      string(12) "Shikaru Neko"
      ["russian"]=>
      string(23) "Ругающий кот"
      ["image"]=>
      array(4) {
        ["original"]=>
        string(44) "/system/animes/original/48442.jpg?1615418299"
        ["preview"]=>
        string(43) "/system/animes/preview/48442.jpg?1615418299"
        ["x96"]=>
        string(39) "/system/animes/x96/48442.jpg?1615418299"
        ["x48"]=>
        string(39) "/system/animes/x48/48442.jpg?1615418299"
      }
      ["url"]=>
      string(26) "/animes/48442-shikaru-neko"
      ["kind"]=>
      string(2) "tv"
      ["score"]=>
      string(3) "0.0"
      ["status"]=>
      string(5) "anons"
      ["episodes"]=>
      int(0)
      ["episodes_aired"]=>
      int(0)
      ["aired_on"]=>
      string(10) "2021-04-01"
      ["released_on"]=>
      NULL
    }
  }

How do I output the value of $original from this array?

T.J. Crowder
  • 1,031,962
  • 187
  • 1,923
  • 1,875

1 Answers1

0

because you are using $list = json_decode($result, true) - true means ..

https://www.php.net/manual/en/function.json-decode.php associative

When true, JSON objects will be returned as associative arrays; when false, JSON objects will be returned as objects. When null, JSON objects will be returned as associative arrays or objects depending on whether JSON_OBJECT_AS_ARRAY is set in the flags.

echo $list['next_episode'];

or

$list = json_decode($result);
echo $list->next_episode;
Muneeb
  • 85
  • 1
  • 10