Closed elreco closed 4 years ago
I found a solution,
$champions = DataDragonAPI::getStaticChampions();
foreach($champions['data'] as $c){
if(strcasecmp($c['name'], $champion) == 0){
$champion = intval($c['key']);
}
}
Hello @elreco, I'm sorry for responding so late 😞 There are also dedicated functions in DataDragonAPI
for finding champions by their keys/IDs (not their actual names, e.g.: Annie
, Wukong
, …, you have solved that correctly):
Annie
, MonkeyKing
, …) you can use DataDragonAPI::getStaticChampionById($champion_name)
(this isn't mistake, it really is Id
.)DataDragonAPI::getStaticChampionByKey($champion_id)
(this isn't mistake, it really is Key
.)Then you can easily access all their attributes - name
, key
, id
, …
Hello!
Is there a way to get a champion ID with a given name?
Thank you!