Why to you ask? Did you not even try it yet and see that it
didn't do what you wanted?
In the process of evaluating the if() construct, here's (more or less)
what happens:
<ol><li>The quoted string is processed, expending any $variables in it. (If a particular $variable does not exist, it's replaced by an empty string.)<li>The result is a single string:<br> if ("something...") <li>The PHP interpreter most certainly does not look inside the string a second time to see if it can evaluate the contents of the string as a logical expression<li>Rather, the expression is simply <b>if</b> followed by a non-empty string, which has a value of <b>true</b> in this context, so the if always succeeds.</ol>
I don't think there is a shortcut to separately testing every field. Fortunately, this is merely tedious, rather than being actually complicated:
if ( $password == '' // that's two single-quotes here and after
|| $confirm == ''
|| username == ''
|| $email == ''
|| $real_name == '')
{
echo "You left something out...";
}