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

8. PHP Switch Statement

15/01/2020
in PHP, Programming
PHP Switch Statement

PHP Switch Statement

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!";
}
?>

 

Tags: PHP
ShareTweetShare

Related Posts

Cara Mudah Memahami Bahasa Pemrograman Python
Python

Belajar Dasar-dasar Python untuk Pemula: Cara Mudah Memahami Bahasa Pemrograman Python

Python adalah bahasa pemrograman tingkat tinggi yang dapat digunakan untuk membuat berbagai macam aplikasi. Python diciptakan oleh Guido van Rossum...

06/03/2023
Relasi Tabel Database Menggunakan Operasi Join dan Model Klasik
Belajar PHP

Relasi Tabel Database Menggunakan Operasi Join dan Model Klasik

MySQL adalah database relational yang sangat populer di dunia programming hari ini. Dengan memiliki fitur yang bisa dikaitkan antar tabel,...

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

14. PHP Forms – Validation With Required Fields

Hi everyone, this time we will discuss about PHP Validation using the Required Field. Not many people know, it turns...

15/02/2020
PHP Form Handling
PHP

13. New Performing PHP Form Handling

Detriamelia.Com - Running form functions in PHP is not difficult. By using the $ _POST and $ _GET methods it...

13/02/2020
Next Post
PHP Loop (While, For, Foreach) Definition and Example

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

PHP Function Definition and Example

10. PHP Function Definition and Example

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recommended

PEMROGRAMAN WEB DAN PERANGKAT BERGERAK – PERPUSTAKAAN PART-1

Pemrograman Web dan Perangkat Bergerak – Perpustakaan Part-1

16/04/2020
PHP Switch Statement

8. PHP Switch Statement

15/01/2020
Detailed Explanation of PHP Data Types

6. Detailed Explanation of PHP Data Types

15/01/2020
Learn PHP Global Variables - Superglobals With Example

12. Learn PHP Global Variables – Superglobals With Example

20/01/2020

Instagram Feed

  • Sekolah sambil bermain...
  • Produk mahasiswa semester 5 Pendidikan Teknologi Informasi STKIP Rokania..
Kran dispenser otomatis (sensor)
#arduino
#PTI Ok
#STKIPRokania
#AyoKuliahDiRokania
  • Salah satu produk mahasiswa Pendidikan Teknologi Informasi STKIP Rokania...Pemanfaatan Internet Of Thing pada Lampu dan CCTV otomatis dengan Telegram Bot..

#StkipRokania
#PendidikanTeknologiInformasi
  • "Golden Time" yang tidak bisa diputar dan diulang tetapi tersimpan di inner child nya dan diingat selamanya..
  • Selamat atas M.Kom nya yah...semoga ada Reski untuk studi selanjutnya ya...
  • HOME
  • GIS
  • HTML
  • Bootstrap
  • CSS
  • Javascript
  • Ubuntu
  • Useful Tools
Detriamelia.Com

© 2022 Detri Amelia Chandra - IT Tips and Programming Tutorials.

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