数组替换ID [PHP]

时间:2016-01-04 14:48:42

标签: php arrays json

$keep_alive_champions = true;
$this_champ_info = 0;
if($championdata != 'NOT_FOUND')
{
    while($keep_alive_champions == true)
    {
        if(!empty($championdata['champions'][$this_champ_info]))
        {
            $champ_id = $championdata['champions'][$this_champ_info]['id'];
            $seasondata_array[$seasons[$this_season_match]]['ranked_champions']['champions'] = array();
            $seasondata_array[$seasons[$this_season_match]]['ranked_champions']['champions'][$champ_id] = $champ_id;
            $seasondata_array[$seasons[$this_season_match]]['ranked_champions']['champions'][$champ_id] = array();
            $seasondata_array[$seasons[$this_season_match]]['ranked_champions']['champions'][$champ_id]['wins'] = $championdata['champions'][$this_champ_info]['stats']['totalSessionsWon'];

        }
        else
        {
            $keep_alive_champions = false;
        }
        $this_champ_info++;
    }
}

我想创建$seasondata_array[$seasons[$this_season_match]]['ranked_champions']['champions'][$champ_id] $ champ_id是一个变量,意味着一些INT值。 我得到的问题是数组只返回1个值,最后一个添加到数组中,替换所有其他值。

0 个答案:

没有答案