if (!$ip = "MY.IP.HE.RE")
Will always return true because $ip = "MY.IP.HE.RE" will always be true. You are using the assignment operator. You are looking for == ... the equivalence operator.
if (!($ip == "MY.IP.HE.RE"))
if ($ip != "MY.IP.HE.RE")
Works because that checks that the value does not equal MY.IP.HE.RE, although !== is preferred ... I can't recall why though. Maybe someone else will.