未定义的偏移量:0

Working with JSON in PHP and that error keeps popping up.The PHP code I'm using is

echo $JSON["response"]["players"][0]["steamid"];

The actual JSON is right here. The var dump is

array(1) { ["response"]=> array(1) { ["players"]=> array(0) { } } }

I used an online JSON viewer and it looks just fine to me.

Anybody got any ideas?

By default, json_decode will decode objects as stdClass instances that do not implement ArrayAccess. Your code should probably emit an error. You should actually be using:

$JSON->response->players[0]->steamid;

You could also use true for the second argument of json_decode.

This works with the JSON provided in your link, but the var_dump seems to indicate that the JSON in the link is not the same JSON that the PHP script is acquiring. Make sure that you are using the correct parameters to get this JSON remotely.