-1

I cannot seem to get the string that is in my variable to be detected by my loop. In this code it is set to "BRONZE" and "I" and does not seem to do the comparison check correctly. Any pointers on to why?

$teir = $league->data->summonerLeagues[0]->tier;
echo $teir;
$rank = $league->data->summonerLeagues[0]->requestorsRank;
echo '<pre>';
print_r($rank);
echo '</pre>';

if($tier === "BRONZE")
{
${"s".$count."v"} += 0;
}
else if($teir == "SILVER")
{
${"s".$count."v"} += 5;
}
else if($teir == "GOLD")
{
${"s".$count."v"} += 10;
}
else if($teir == "PLATINUM")
{
${"s".$count."v"} += 15;
}
else 
{
${"s".$count."v"} += 20;
}

if($rank == "V")
{
${"s".$count."v"} += 1;
}
else if($rank == "IV")
{
    ${"s".$count."v"} += 2;
}
else if($rank == "III")
{
    ${"s".$count."v"} += 3;
}
else if($rank == "II")
{
    ${"s".$count."v"} += 4;
}
else
{
    ${"s".$count."v"} += 5;
}

echo '<pre>';
print(${"s".$count."v"});
echo '</pre>';

thanks for all your help!

2
  • 2
    There's a typo in the first comparison: $tier instead of $teir. Aug 30, 2013 at 19:24
  • This question appears to be off-topic because it is about a typo
    – Pascamel
    Aug 30, 2013 at 19:26

1 Answer 1

3

Yes. You are using $tier to check for BRONZE and $teir for the other checks. The spellings are different.

Not the answer you're looking for? Browse other questions tagged or ask your own question.