I am trying to Json decode something and get the value I want.
But I get PHP undefined index error.
This is my code.
<?php
$json = '[{"totalGamesPlayed":25,"championId":0}]';
$data = json_decode($json,true);
$games = $data['totalGamesPlayed'];
echo $games;
?>
The problem is the “[” “]” are messing with my code…
I am using an API to get some values.
What I get is this : http://pastebin.com/XrqkAbJf
I need the totalGamesPlayed,the champion ID’s except zero (82,106 and 24)
and the TOTAL_SESSIONS_WON and TOTAL_SESSIONS_LOST for these ID’s…
For a start, let’s find out how can I bypass the “[” and “]” symbols,and then things may be easier..
Thank you in advance!
Access your code like this
Code for getting other info