php - How to extract information and transform true to 1? -


i got code :

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

this code extract information api, , want how value "true" in api, soo i've tried convert "true" 1, still not working well.
in api there 8 "true" when i've tried print $winner got 2.
please correct code ?

just make $win = $matches['participants'][0]['stats']['winner']; , if $win equal true increment $winner.

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

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -