mardi 31 mars 2015

Extract information and transform true to 1

I got this code :



foreach($data['matches'] as $matches){
$win += $matches['participants'][0]['stats']['winner'];
if ($win == true){
$winner+= '1';
}
}


This code extract information from an API, and what I want is how much the value "true" is in the API, soo i've tried to convert "true" to 1, but still not working well.

In the api there are 8 "true" but when i've tried to print $winner i got just 2.

What to do please to correct the code ?


Aucun commentaire:

Enregistrer un commentaire