RE: [PHP] group comparision

From: Date: Thu, 17 May 2001 08:50:06 +0000
Subject: RE: [PHP] group comparision
Groups: php.general 
Request: Send a blank email to php-general+get-53185@lists.php.net to get a copy of this message
How about if (($add + $remove + $view) > 1) { //error } -Stewart -----Original Message----- From: charles@lunarmedia.net [mailto:charles@lunarmedia.net] Sent: 17 May 2001 09:45 To: php-gen Subject: [PHP] group comparision i have a php script that has three variables that could be set to "1" depending on the values of a form being sent to the .php file. $add $remove $view i need to do some error control in my script to make certain that one and only one of these is set to "1". i am coming up with a very long control structure: if (($add="1") && ($remove="1") || ($add="1") && ($view="1") || etc...)) is there a shorter method to do this? and can i break this up onto multiple lines to make my code a bit cleaner? can i do something like: if ( ($add="1") && ($remove="1") || ($add="1") && ($view="1") || ($remove="1") && ($view="1") ) { Thanks! -Charles -- ** There are two major products to come out of Berkeley: LSD and UNIX. We don't believe this to be a coincidence. ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#53185) next »