Answer by Walter Tross for Type-juggling and (strict) greater/lesser-than...
After your correction of the second part of your question, I leave the answer to that part to the others. I just want to give the most surprising answer to the first part of your question, i.e.,...
View ArticleAnswer by CSᵠ for Type-juggling and (strict) greater/lesser-than comparisons...
There are nostrict identical comparison operators (>== or <==) in PHP (by PHP 5.6.14 at least), but there are a few ways to enforce a strict type check before checking Greater/Lower:Check both...
View ArticleAnswer by NikiC for Type-juggling and (strict) greater/lesser-than...
PHP's comparison operators deviate from the computer-scientific definitions in several ways:In order to constitute an equivalence relation== has to be reflexive, symmetric and transitive:PHP's ==...
View ArticleType-juggling and (strict) greater/lesser-than comparisons in PHP
PHP is famous for its type-juggling. I must admit it puzzles me, and I'm having a hard time to find out basic logical/fundamental things in comparisons.For example: If $a > $b is true and $b > $c...
View Article