Learn your language’s basic features
Saturday, January 28th, 2006
Sometimes I’d really like to bash in my own head with a 2×4. I just spent at least 20 minutes figuring out why the boolean expression
($options & PW_SORT_DATE == PW_SORT_DATE)
didn’t evaluate to true, even though $options had a value of 2 and so did PW_SORT_DATE. Then I suddenly realised that PHP’s == operator precedes the & operator.
(($options & PW_SORT_DATE) == PW_SORT_DATE)
works like a charm.
I should know better than not too learn the basics of the programming languages I work with. :)