Here's what I'm trying to achieve, which at the moment returns "error", despite $assign
holding the value A.
if ($assign === "A") {
echo "Assign is A";
}
elseif ($assign === "B") {
echo "Assign is B";
}
else {
echo "error";
}
$assign
is getting its value from an array, as shown below where I checked anything I could think of. The strcmp
below returns -52, which has me stumped. $assignments[0]
definitely holds "A", without any extraneous spaces or characters, and the type is definitely string.
$assign = $assignments[0];
print_r ($assign);
print (gettype($assign));
echo strcmp ($assign, "A");
I'm assuming that the issue is that I'm not assigning $assign
the value "A" but instead some sort of reference to it as it comes from an array, but I'm afraid that's as far as my troubleshooting has gotten me!