Advertisement
aldinokemal

Match Statement

Sep 25th, 2022
716
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. $nilai = "C";
  4.  
  5. $value = match ($nilai) {
  6.     "A" => "Anda lulus dengan baik",
  7.     "B", "C" => "Anda lulus",
  8.     "D" => "Anda tidak Lulus",
  9.     "E" => "Sepertinya anda salah jurusan",
  10.     default => "Nilai tidak ditemukan"
  11. };
  12.  
  13. echo $value;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement