note 97080 added to language.operators.comparison
| From: | taras dot bogach at gmail dot com | Date: | Wed, 31 Mar 2010 15:46:06 +0000 |
| Subject: | note 97080 added to language.operators.comparison | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-167561@lists.php.net to get a copy of this message | ||
//Boolean switch usege
class User_Exception extends Exception{}
class User{
public function register($login,$pass,$passCheck)
switch(false){
case(strlen($pass) >= 5):
throw new User_Exception("Password must be at last 5 chars length");
case($pass == $passCheck):
throw new User_Exception("Password is not confirmed!");
case(strlen($login) >= 5):
throw new User_Exception("Login must be at last 5 chars length");
//Do other checks
default:
//Do registration
return true;
}
}
//...
}
----
Server IP: 213.186.192.247
Probable Submitter: 93.180.214.28
----
Manual Page -- http://www.php.net/manual/en/language.operators.comparison.php
Edit -- https://master.php.net/note/edit/97080
Del: integrated -- https://master.php.net/note/delete/97080/integrated
Del: useless -- https://master.php.net/note/delete/97080/useless
Del: bad code -- https://master.php.net/note/delete/97080/bad+code
Del: spam -- https://master.php.net/note/delete/97080/spam
Del: non-english -- https://master.php.net/note/delete/97080/non-english
Del: in docs -- https://master.php.net/note/delete/97080/in+docs
Del: other reasons-- https://master.php.net/note/delete/97080
Reject -- https://master.php.net/note/reject/97080
Search -- https://master.php.net/manage/user-notes.php