Advertisement
aldinokemal

Tenary Operator

Sep 25th, 2022
709
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. // ==================== Normal Operator ==================== //
  3. $gender = "LAKI";
  4.  
  5. if ($gender) {
  6.     $hi = "Halo bro !!";
  7. } else {
  8.     $hi = "Halo sis !!";
  9. }
  10.  
  11. echo $hi;
  12.  
  13. // ==================== Tenary Operator ==================== //
  14. $gender = "PEREMPUAN";
  15.  
  16. $hi = $gender == "LAKI" ? "Halo bro !!" : "Halo sis !!";
  17. echo $hi;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement