When I attempt to determine if a user is in an array of users, for some reason it is only returning true when the user is in the 0th position.
For the life of me I cannot figure out what I am doing wrong.
This does not echo "True"
echo $usersign; // RDW
print_r($these_analysts[0]); // Array ( [0] => JKB [1] => RDW )
if(in_array($usersign,$these_analysts[0])){
echo "True";
}
This echoes "True"
echo $usersign; // RDW
print_r($these_analysts[0]); // Array ( [0] => RDW [1] => CLM )
if(in_array($usersign,$these_analysts[1])){
echo "True";
}
EDIT:
vardump
gives a much more comprehensive view of the array, whereas print_r
did show the trailing spaces, it didn't catch my eye.
For some reason the first element of each array was giving string3, and all others were giving string4.
var_dump
to your question for$these_analysts
"RDW"
or isRDW
a constant?error_reporting(-1)
to your php to show all possible errors/warnings/notices/whatevers.