some_function($input) returns the integer 23
$other_int has a value that is not equal to 23
Code snippet 1
if ($int = some_function($input) && $int != $other_int) {...}
Code snippet 2
$int = some_function($input);
if ($int != $other_int) {...}
I coded snippet 1 thinking that the if statement would return true given the above conditions. I was wrong.
The if statement in snippet 2 is true.
Why?