note 73559 deleted from language.control-structures by mgf

From: Date: Thu, 28 Aug 2008 14:56:38 +0000
Subject: note 73559 deleted from language.control-structures by mgf
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-143942@lists.php.net to get a copy of this message
Note Submitter: mongoose643 at gmail dot com ---- @simplyduh >Duh, both are booleans in the above case, and its obvious >that checking one boolean is better than checking 2. >if ($has_delete_permissions) would work better :) I read dougnoel's post. He was providing an example of a BAD example. The last line in his post suggests that you NOT check for both - only the admin. So actually what he meant to check for is whether or not they are an admin. If so then they automatically have delete permissions - therefore it may be possible that no variable named "$has_delete_permissions" exists. The resulting statement would be as follows: if($is_admin) { //Statements to delete stuff go here. }

« previous php.notes (#143942) next »