'oda','yukiko'=>'yukiko'); $total = 0; $black_total = 0; $white_total = 0; foreach($b as $val){ $black_count = substr_count($val[0],'b'); $white_count = substr_count($val[0],'w'); $black_total += $black_count; $white_total += $white_count; $total += ($black_count + $white_count); } if($total%2 !== 0){ echo $first_player; }else{ unset($players[$first_player]); echo array_shift($players); } echo "\n"; ?>