Advertisement
dysphafiz_

Untitled

Sep 25th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.46 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <title>Coding Correction 1 (M. Hafidz Fadillah - XI RPL 2)</title>
  5. </head>
  6. <body>
  7.     <h2>Pakai Ternary:<br>
  8.         <?php
  9.             $nilai = 85;
  10.             $hasil = ($nilai > 70 ? "baik" : "buruk");
  11.             echo "hasilnya adalah $hasil dengan bilangan $nilai";
  12.             //hasil baik
  13.         ?>
  14.     </h2>
  15.  
  16.     <h3>Tanpa Ternary:<br>
  17.         <?php
  18.             $nilai = 85;
  19.             if ($nilai = 85) {
  20.                 echo 'baik';
  21.             }
  22.             else {
  23.                 echo 'buruk';
  24.             }
  25.         ?>
  26.     </h3>
  27. </body>
  28. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement