Advertisement
ujiajah1

php_multidimensi_belanja

Sep 24th, 2016
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.56 KB | None | 0 0
  1. <?php
  2. print "Selamat Belanja ". "<br /><br />";
  3.  
  4. $belanja = array(array ('pilih barang', 'beli'),
  5. array('bayar', 'hitung'));
  6.  
  7. $pilihbarang = array('minyak' => 50000,
  8.                      'beras' => 250000,
  9.                      'telur'=>70000);
  10.    
  11. $store_1 = $belanja[0][0];
  12. $store_2 = $belanja[0][1];
  13.  
  14. echo strtoupper ($store_1)." <b> : </b> " ."<br />";
  15.  
  16. foreach($pilihbarang as $pilih => $ambil){
  17. echo "<li>".$pilih . " : " .$ambil."</li>";
  18.     }
  19. echo "<br />";
  20. $bayar = $pilihbarang['minyak']+$pilihbarang['beras']+$pilihbarang['telur'];
  21. echo "Total Belanja Anda : " ."Rp. ".$bayar;
  22. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement