The if will be entered if $fieldsAreFilled is true AND !$hostInfoEqualsInput is true, that is: if $fieldsAreFilled is true AND$hostInfoEqualsInput is false!
So:
This condition must be true: (!empty($hostNameInput) && !empty($hostAddressInput))
This condition must be false: ($hostNameInfo == $hostNameInput && $hostAddressInfo == $hostAddressInput)
@Kalon: yes… it was a missunderstanding of my part.
AHHHH!! It’s a convention. Ok. I thought you are telling that, for no matter what if statement, of no matter what circumstances, the first condition must be true.
I lost the context of my own answer! How worst can I get?! :S
Oh well… thanks a lot, your explanation clear it out.
Well to take things one level of confusion deeper, the truthiness of each comparison is only calculated when the conditions before them are valid.
What does that mean? Delayed operations.
When a function such as foo() might throw a warning or an error, you can perform some kind of check before it, and the function will only be called when the check is valid.
With the following code, the foo() function will never be called. The first condition acts as a guard, so you can check if some condition is correctly met before running something.
$a = (false && foo());
$b = (true || foo());
There’s more on this too at the logical operators documentation page.