!= operator is not working

Dell / Lap top
September 21, 2009 at 11:18:57
Specs: Windows XP, pentium 4
Thi shouldn't be that tough. I have two numbers coming out of a db, i put them into variables then try and run an if statement..

if ($a != $b) { show this; }

its not working. the show this always shows. Why would that operator not work. And it seems like it just happened because it was working fine for the past XX amount of years. Thoughts?

See More: != operator is not working

Report •

September 21, 2009 at 12:58:48
php is a "loose" language and *may* be comparing strings to ints or other types as it stores data from the db. If the data being assigned is valid, then what you might try is the settype function.

settype($a, "integer");
settype($b, "integer");

if($a != $b) { show this; }

Report •
Related Solutions

Ask Question