Hello,
Im having a spot of bother with the below function.Its been a year or two since I looked at any php so I thought I would try and make a noughts and crosses game to refreash my memory while I was off over Christmas "just for fun" and Ive hit a block in the road.
The array holds the either a 0 or a x so I am testing for three in a line. I thought maybe it was because I was testing to arrays against each other but I tested $array_cont_val[1][1] == $x as well with no joy.
Any help would be greatly appriated
function who_won($array_cont_val){
$x = 23;
if($array_cont_val[1][1] == $array_cont_val[1][2] && $array_cont_val[1][3] == $array_cont_val[1][2]){
$x = "wins";
} elseif ($array_cont_val[2][1] == $array_cont_val[2][2] && $array_cont_val[2][3]) == $array_cont_val[2][2] {
$x = "wins";
}elseif($array_cont_val[3][1] == $array_cont_val[3][2] && $array_cont_val[3][3] == $array_cont_val[3][2]){
$x = "wins";
}elseif($array_cont_val[1][1] == $array_cont_val[2][1] && $array_cont_val[3][1] == $array_cont_val[2][1]){
$x = "wins";
}elseif($array_cont_val[1][2] == $array_cont_val[2][2] && $array_cont_val[3][2]) == $array_cont_val[2][2] {
$x = "wins";
}elseif{($array_cont_val[1][3] == $array_cont_val[2][3] && $array_cont_val[3][3] == $array_cont_val[2][3]){
$x = "wins";
}elseif{($array_cont_val[1][1] == $array_cont_val[2][2] && $array_cont_val[3][3] == $array_cont_val[2][2]){
$x = "wins";
}
}
}
}