我在这里有一个foreach循环:
foreach($decode_rewardsAPIResponse->rewardUnlockStatus as $key=>$value){
echo $value->rewardID;
}
我想要实现的是能够获得循环的rewardID中的下一个项目。我尝试使用next($value->rewardID)
但没有运气。
以下是我收到的数据示例:
{"currentMilestone":2,"rewardUnlockStatus":[{"rewardID":1,"stepsRequired":0,"unlockedForUser":true},{"rewardID":2,"stepsRequired":0,"unlockedForUser":true},{"rewardID":3,"stepsRequired":2200,"unlockedForUser":false},{"rewardID":4,"stepsRequired":5200,"unlockedForUser":false},{"rewardID":5,"stepsRequired":8200,"unlockedForUser":false},{"rewardID":6,"stepsRequired":11200,"unlockedForUser":false},{"rewardID":7,"stepsRequired":14200,"unlockedForUser":false},{"rewardID":8,"stepsRequired":17200,"unlockedForUser":false},{"rewardID":9,"stepsRequired":20200,"unlockedForUser":false},{"rewardID":10,"stepsRequired":23200,"unlockedForUser":false},{"rewardID":11,"stepsRequired":26200,"unlockedForUser":false},{"rewardID":12,"stepsRequired":29200,"unlockedForUser":false},{"rewardID":13,"stepsRequired":32200,"unlockedForUser":false},{"rewardID":14,"stepsRequired":35200,"unlockedForUser":false},{"rewardID":15,"stepsRequired":38200,"unlockedForUser":false}]}