I was working with something involving !=, which always manages to find some way to trip me up, but I'm finding this one odd and I'm wondering if one of you fine people can shed some light on it. This was the setup:
if (($thing != 0) && ($thing != "")) {echo "Hello";}
If $thing = 1, then this works.If $thing = 'taco', this does not work. But if $thing == 'taco', then obviously it doesn't equate to 0. The way I figured out a solution to this was by changing it to this:
if (($thing != "0") && ($thing != "")) {echo "Hello";}
With the 0 in quotation marks. Why did I have to do that? My guess is that if $thing is a string and my comparison is looking for an integer, that it borks it up somehow. But someone who knows would be nice.