Friday, 13 September 2013

PHP strcmp is not returning the correct answer with session variable

PHP strcmp is not returning the correct answer with session variable

I have a session variable $_SESSION['condition'], I know it is set because
when I entered this:
echo $_SESSION['condition']." = "."Below Average";
It returns:
Below Average = Below Average
When I do a gettype() on the session variable it returns type "string".
Yet when I do strcmp() it returns: -34
I have also tried an IF statement with == rather than strcmp testing for
equality AND an IF statement casting them both as strings and testing if
they are equal with no luck.
Any reason why this could be?

No comments:

Post a Comment