note 119727 deleted from language.operators.logical by cmb

From: Date: Thu, 11 Aug 2016 16:15:06 +0000
Subject: note 119727 deleted from language.operators.logical by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-206264@lists.php.net to get a copy of this message
Note Submitter: Soaku ---- I had problem in my app, where I (with nick Soaku) had access to admin options. But everyone logged in also had it... I found out the problem soon. Correctly, I had this in the code: <?php if (!$user->username == "Soaku") { # [...] } ?> I thought it would return the reversed result of $user->username == "Soaku", but it always returned false for logged in people. To prevent this, instead of the previous example, always do this: <?php if (!($user->username == "Soaku")) { # [...] } ?> or this: <?php if ($user->username != "Soaku") { # [...] } ?>

« previous php.notes (#206264) next »