note 97080 modified in language.operators.comparison by danbrown

From: Date: Wed, 31 Mar 2010 16:15:56 +0000
Subject: note 97080 modified in language.operators.comparison by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-167566@lists.php.net to get a copy of this message
Boolean switch usege <?php 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; } } //... } ?> --was-- //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; } } //... } http://php.net/manual/en/language.operators.comparison.php

« previous php.notes (#167566) next »