Home php教程 PHP开发 Example code for using switch statement to make multiple selections

Example code for using switch statement to make multiple selections

Dec 26, 2016 am 10:54 AM

The examples are as follows:

<!doctype html>
<meta http-equiv="content-type" content="text/html" charset="utf-8"/>
switch语句,switch语句用于根据多个不同条件执行不同动作。<br/>
如果你希望有选择地执行若干代码块之一,还请使用switch语句。
<br/>
语法结构如下:
<pre class="brush:php;toolbar:false">
switch(n)
{
case label1:
  如n=label1,此处代码将执行;
  break;
case label2:
  如n=label2,此处代码将执行;
  break;
case label3:
  如n=label3,此处代码将执行;
  break;
default:
  如果n既不等于label1页不等于label2,此处代码将执行;
}

我们写一个程序,一个单选框。用switch语句半段。
程序如下:
红色:
蓝色:
绿色:
Copy after login

The above is the entire content of the example code that the editor brought to you for using the switch statement to make multiple selections. I hope Please support the PHP Chinese website~

For more relevant articles on example codes that use switch statements to perform multiple selections, please pay attention to the PHP Chinese website!

Statement of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)