Wednesday, 24 May 2017

PHP's operator




What does the <> operator mean exactly?



Is it the same as != (not equal)?




Sample code



$foo = 'text';

if ($foo <> 'photo') {
echo 'foo';
}
else {
echo 'bar';

}

Answer



As NikiC notes, <> and != are the same and have the same precedence. My earlier answer was based on what appears to be a bug in the documentation which has now been corrected.


No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...