I was just browsing a forum and someone asked about a PHP file they had found on the web. It has several spots like this in the code:
if ($REMOTE_ADDR == \"\"
9 years on and I'm surprised no-one's mentioned the ternary operator:
$ip = ($REMOTE_ADDR == "") ? "no ip" : getHostByAddr($REMOTE_ADDR);
Much clearer for assignment IMHO - because it leads out with the variable being assigned to, as for usual variable assignment.