I am passing in $data as an array Color, Number(1-6); $RouteTwo is an array of 18 elelments of colors{Red, Yellow, Green, Blue, Black}; and $saveNewPos is a variable that stores a color from another function.
I want to compare $data[0] to $saveNewPos, but it does not appear to work. when I echo the variables separate they me Yellow which is correct, but it does not get into the appropriate elseif statement.
Can someone explain this to me?
Thank You in advance.
patrick
I want to compare $data[0] to $saveNewPos, but it does not appear to work. when I echo the variables separate they me Yellow which is correct, but it does not get into the appropriate elseif statement.
Can someone explain this to me?
Code:
public function ArrayWater($data,$RouteTwo,$saveNewPos)
{
echo"(ArrayWater)your in the save new Array function look for which player: <br>";
echo "data[0] = " .$data[0]. " <br>saveNewPos = " .$saveNewPos. " <br>";
if( $data[0] == $saveNewPos){
$Player_Array[0][2] = "Route Two";
$Player_Array[0][3] = $RouteTwo[0];
$Player_Array[0][5] = $RouteTwo;
}
elseif($data[0] == $saveNewPos){
echo "(ARRAYWATER P2)you in array two";
$Player_Array[1][2] = "Route Two";
$Player_Array[1][3] = $RouteTwo[0];
$Player_Array[1][5] = $RouteTwo;
}
elseif($data[0] == $saveNewPos){
$Player_Array[2][2] = "Route Two";
$Player_Array[2][3] = $RouteTwo[0];
$Player_Array[2][5] = $RouteTwo;
}
elseif($data[0] == $saveNewPos){
$Player_Array[3][2] = "Route Two";
$Player_Array[3][3] = $RouteTwo[0];
$Player_Array[3][5] = $RouteTwo;
}
else
{echo("Error: error in Water Array Function" );}
}
Thank You in advance.
patrick