PHP if ( $some_var == 1 ) always returns true even if it's not true?
问题 This issue is simple, but I am not sure what is the best approach to get around it. If the variable contains a number, how can I make sure that the if statement only returns true if indeed the $some_var is one? 回答1: you need to use 3 equals if($some_var ===1){ here is more info http://php.net/manual/en/language.operators.comparison.php 回答2: The number 1 is a shortcut for "true". In order to specify that it must actually be true, you want to use a triple equals operator. This makes sure it