Detri Amelia Chandra
  • HOME
  • PHP Tutorial
  • GIS
  • HTML
  • Bootstrap
  • CSS
  • Javascript
  • Ubuntu
  • Useful Tools
    • URL Redirect Tool
    • URL Download Encryptor
No Result
View All Result
  • HOME
  • PHP Tutorial
  • GIS
  • HTML
  • Bootstrap
  • CSS
  • Javascript
  • Ubuntu
  • Useful Tools
    • URL Redirect Tool
    • URL Download Encryptor
Detri Amelia Chandra
No Result
View All Result

8. PHP Switch Statement

Detri Amelia Chandra by Detri Amelia Chandra
15/01/2020
in PHP, Programming
0
PHP Switch Statement

PHP Switch Statement

0
SHARES
77
VIEWS
Share on FacebookShare on Twitter

Switches are not much different from If Else. Both of them describe conditions. The switch statement is used to perform different actions based on different conditions. Please pay attention and practice the explanation below.
The PHP Switch Statement
Use the switch statement to select one of many blocks of code to be executed.
This is the manner by which it works: First we have a solitary articulation n (regularly a variable), that is assessed once. The estimation of the articulation is then contrasted and the qualities for each case in the structure. In the event that there is a match, the square of code related with that case is executed. Use break to keep the code from running into the following case consequently. The default proclamation is utilized if no match is found.
See the example below :
[the_ad id=”651″]

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php
$favcolor = "red";
switch ($favcolor) {
    case "red":
        echo "Your favorite color is red!";
        break;
    case "blue":
        echo "Your favorite color is blue!";
        break;
    case "green":
        echo "Your favorite color is green!";
        break;
    default:
        echo "Your favorite color is neither red, blue, nor green!";
}
?>

 

Recommended Post

Relasi Tabel Database Menggunakan Operasi Join dan Model Klasik

14. PHP Forms – Validation With Required Fields

14. PHP Forms – Validation With Required Fields

Tags: PHP
Previous Post

7. Understanding PHP Condition If Else, Elseif Statements

Next Post

9. PHP Loop (While, For, Foreach) Definition and Example

Related Posts

Relasi Tabel Database Menggunakan Operasi Join dan Model Klasik

Relasi Tabel Database Menggunakan Operasi Join dan Model Klasik

30/04/2020
PHP Forms - Validation With Required Fields

14. PHP Forms – Validation With Required Fields

15/02/2020
PHP Forms - Validation With Required Fields

14. PHP Forms – Validation With Required Fields

15/02/2020
PHP Form Handling

13. New Performing PHP Form Handling

13/02/2020
Learn PHP Global Variables - Superglobals With Example

12. Learn PHP Global Variables – Superglobals With Example

20/01/2020
PHP Array Example, Complete Editions

11. PHP Array Example, Complete Editions

17/01/2020
Next Post
PHP Loop (While, For, Foreach) Definition and Example

9. PHP Loop (While, For, Foreach) Definition and Example

Tinggalkan Balasan Batalkan balasan

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *

Top Stories

Relasi Tabel Database Menggunakan Operasi Join dan Model Klasik

Relasi Tabel Database Menggunakan Operasi Join dan Model Klasik

30/04/2020
PEMROGRAMAN WEB DAN PERANGKAT BERGERAK – PERPUSTAKAAN PART-1

Pemrograman Web dan Perangkat Bergerak – Perpustakaan Part-1

16/04/2020
PEMROGRAMAN WEB DAN PERANGKAT BERGERAK – PERPUSTAKAAN PART-1

Pemrograman Web dan Perangkat Bergerak – Perpustakaan Part-1

16/04/2020

News & More

Categories

  • Counseling
  • Consultations
  • Relationship
  • Friendship
  • Singlehood

About Us

We bring you the best Premium WordPress Themes that perfect for news, magazine, personal blog, etc. Check our landing page for details.

Connect on Social

© 2019 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • HOME
  • PHP Tutorial
  • GIS
  • HTML
  • Bootstrap
  • CSS
  • Javascript
  • Ubuntu
  • Useful Tools
    • URL Redirect Tool
    • URL Download Encryptor

© 2021 Detri Amelia Chandra - IT Tips and Programming Tutorial.