Dalam PHP kita menggunakan fungsi "pow" untuk menghitung hasil perpangkatan suatu bilangan. Struktur penggunaan pow yaitu: pow($bilangan, $pangkat);
Contoh source code keseluruhannya, yaitu:
1 2 3 4 5 6 | while ($bil_awal <= $bil_akhir) { if ($bil_awal == 0 || $bil_akhir == 0) { echo "Hasil Tidak Terhingga"; } else if ($pembagi == 0) { echo "Hasil Tidak Terhingga"; |
1 2 3 4 5 6 7 | <?php @$bil_awal = $_POST['bil_awal']; @$bil_akhir = $_POST['bil_akhir']; @$pengali = $_POST['pengali']; @$hasil_penjumlahan = 0; @$hasil_perkalian = 0 ?> |
1 2 3 4 5 | <?php @$borrow1 = $_POST['borrow1']; @$borrow2 = $_POST['borrow2']; @$borrow3 = $_POST['borrow3']; ?> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | <!DOCTYPE HTML> <html> <head> <title>DATE</title> </head> <body> <form name="form_date" action="input_date.php" method="POST"> <center> <label>Date : </label> <input name="input_date" type="date" value=<?php echo $date; ?>/><br/><br/> <input type="submit" value="SUBMIT"/><br/><br/> <?php echo $format1; ?> </center> </form> </body> </html> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <!DOCTYPE HTML> <html> <head> <title>RADIO BUTTON</title> </head> <body> <form name="form_radio" action="radio_button.php" method="POST"> <br/><br/> <center> <label>Gender : </label> <input name="gender" type="radio" required="" value="Male" <?php if($gender == "Male"){echo 'checked';} ?> />Male <input name="gender" type="radio" required="" value="Female" <?php if($gender == "Female"){echo 'checked';} ?> />Female<br/><br/> <input type="submit" value="SUBMIT"/><br/><br/> </center> </form> </body> </html> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | <!DOCTYPE HTML> <html> <head> <title>COMBO BOX</title> </head> <body> <form name="form_combo" action="combo_box.php" method="POST"> <br/><br/> <center> Option : <select name="option"> <option <?php if($option == 'Playing'){echo 'selected';} ?>>Playing</option> <option <?php if($option == 'Reading'){echo 'selected';} ?>>Reading</option> <option <?php if($option == 'Swimming'){echo 'selected';} ?>>Swimming</option> <option <?php if($option == 'Racing'){echo 'selected';} ?>>Racing</option> </select><br/><br/> <input name="submit" type="submit"/><br/><br/> <?php echo $option; ?> </center> </form> </body> </html> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | <!DOCTYPE HTML> <html> <head> <title>TEXTAREA</title> </head> <body> <form name="form_text_area" action="textarea.php" method="POST"> <br/><br/> <center> <h1>TEXTAREA</h1> <textarea name="text_area" style="height: 150px; width: 250px"> <?php echo $text_area; ?> </textarea><br/><br/> <input name="submit" type="submit" value="SUBMIT"/><br/><br/> <?php echo $text_area; ?> </center> </form> </body> </html> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | <!DOCTYPE html> <html> <head> <title>Input Name</title> </head> <body> <center> <br/><br/><br/> <form action="input_name2.php" method="POST"> <label>Name : </label> <input id="input_name" name="input_name" type="text" value="<?php echo $nama; ?>" /> <input type="submit" value="SUBMIT" /><br/><br/> <h1><?php echo $nama; ?></h1> <h1><?php echo $nama; ?></h1> </form> </center> </body> </html> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <!DOCTYPE html> <html> <head> <title>Input Name</title> </head> <body> <center> <br/><br/><br/> <form action="input_name.php" method="POST"> <label>Name : </label> <input name="input_name" type="text" value="<?php echo $nama; ?>" /> <input name="submit" type="submit" value="SUBMIT" /> <h1><?php echo $nama; ?></h1> </form> </center> </body> </html> |
1 2 3 4 5 6 7 8 9 | <!DOCTYPE HTML> <html> <head> <title>Hello World</title> </head> <body> <center><h1>Hello World ^_^ <h1/></center> </body> </html> |