in reply to Checking Tic-Tac-Toe Win conditions?

Board state is stored in $b in numeric values of 0 (nothing), 1 (one person) and 2 (other person). $m keeps track of whose move it currently is, and is multiplied by -1 each turn. The board check is as follows:
for ($i = 0; $i < 3; $i++) { if ($b[$i][0] == $m && $b[$i][1] == $m && $b[$i][2] == $m) { &win( +$m); } if ($b[0][$i] == $m && $b[1][$i] == $m && $b[2][$i] == $m) { &win( +$m); } } if ($b[0][0] == $m && $b[1][1] == $m && $b[2][2] == $m) { &win($m); } if ($b[0][0] == $m && $b[1][1] == $m && $b[2][2] == $m) { &win($m); }
It requires one loop and four check lines.