aldinokemal

Null Coalescing

Sep 25th, 2022
848
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. // ================ Pengecekan Biasa ================ //
  4. if (isset($_GET['tahun'])) {
  5.     $tahun = $_GET['tahun'];
  6. } else {
  7.     $tahun = date('Y');
  8. }
  9. echo $tahun;
  10.  
  11. // ================ Pengecekan Nullcoalescing ================ //
  12. $tahun = $_GET['tahun'] ?? date('Y');
  13. echo $tahun;
Advertisement
Add Comment
Please, Sign In to add comment