When comparing values in PHP for equality we can use either the == operator or the === operator. The == operator just checks to see if the left and right both values are equal. But, the === operator actually checks to see if the left and right values are equal, and also checks to see if they are of the same variable type (like whether they are both booleans, ints, etc.).
PHP
//bad code:
if ( strpos( $inputString, 'ABC' ) == false ) {
// do something
}
//good code:
if ( strpos( $inputString, 'ABC' ) === false ) {
// do something
}
0 Comment(s)