How to use switch in PHP language _php tutorial

Source: Internet
Author: User
Tags php language

The use of switch in the PHP language


Introduction to the use of switch in the PHP language:

  

$CZC = "Reg";

Switch ($CZC) {

Case ' reg '://Register

echo "Registered code";

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

Case ' logout '://exit

echo "Exit code";

Break

default://This code except reg,logout is executed with the following code

Include ' user/info.php ';

Break

}

/* The result of this code execution is displayed:

The registered Code

*/

?>

http://www.bkjia.com/PHPjc/845128.html www.bkjia.com true http://www.bkjia.com/PHPjc/845128.html techarticle The use of switch in the PHP language is introduced in the PHP language: $CZC =reg; switch ($CZC) {case reg://registering the Echo registration code; break;//If you comment out this sentence, you will execute the code below ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.