note 73559 added to language.control-structures

From: Date: Thu, 01 Mar 2007 14:03:31 +0000
Subject: note 73559 added to language.control-structures
Groups: php.notes 
Request: Send a blank email to php-notes+get-123980@lists.php.net to get a copy of this message
@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. } ---- Server IP: 216.194.113.175 Probable Submitter: 72.15.123.32 ---- Manual Page -- http://www.php.net/manual/en/language.control-structures.php Edit -- https://master.php.net/note/edit/73559 Del: integrated -- https://master.php.net/note/delete/73559/integrated Del: useless -- https://master.php.net/note/delete/73559/useless Del: bad code -- https://master.php.net/note/delete/73559/bad+code Del: spam -- https://master.php.net/note/delete/73559/spam Del: non-english -- https://master.php.net/note/delete/73559/non-english Del: in docs -- https://master.php.net/note/delete/73559/in+docs Del: other reasons-- https://master.php.net/note/delete/73559 Reject -- https://master.php.net/note/reject/73559 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#123980) next »