-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.php
51 lines (44 loc) · 1.3 KB
/
test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
function teladanBaik($a, $b, $z){
return (($b - $a) * $z) + $a;
}
function teladanBuruk($a, $b, $z){
return abs((($b - $a) * $z) - $b);
}
function teladanSedang($a, $b, $c, $z){
$kiri = (($b - $a) * $z) + $a;
$kanan = abs((($c - $b) * $z) - $c);
return min($kiri, $kanan);
}
if(isset($_GET["submit"])){
$x = $_GET["x"];
$y = $_GET["y"];
$arrX = [
"buruk" => buruk(15, 25, $x),
"sedang" => sedang(20, 25, 30, $x),
"bagus" => bagus(25, 35, $x)
];
$arrY = [
"buruk" => buruk(),
"sedang" => sedang($y, 5, 10, 15),
"bagus" => bagus($y, 10, 15)
];
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<form method="get">
<label for="x">Input X</label>
<input type="text" name="x" id="x"><br>
<label for="y">Input Y</label>
<input type="text" name="y" id="y"><br>
<button type="submit" name="submit">Submit</button>
</form>
</body>
</html>