Home  >  Article  >  Backend Development  >  How to use switch in php language_PHP tutorial

How to use switch in php language_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:22:51949browse

How to use switch in php language

Introduction to how to use switch in php language:

$czc="reg";

switch($czc){

case ‘reg’://register

echo "Registered code";

break;//If this sentence is commented out, the following code will be executed, otherwise it will terminate

case ’logout’://Exit

echo "Exit code";

break;

Default://This code except reg and logout executes the following code

include ‘user/info.php’;

break;

 }

/*The result of executing this code is displayed:

Registration code

 */

 ?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/845128.htmlTechArticleUsage of switch in php language Introduction to the usage of switch in php language: $czc=reg; switch($czc) { case reg://Register echo registration code; break;//If you comment out this sentence, the following code will be executed...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn