forked from btcmp/bootcamp186
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Matrix.php
58 lines (51 loc) · 1.27 KB
/
Matrix.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
52
53
54
55
56
57
58
<?php
class Matrix{
public $baris = 0;
public $kolom = 0;
public $matrix = array();
public function setMatrix($n){
$this->baris = $n;
$this->kolom = $n;
for($i = 0; $i < $this->baris; $i++){
for($j = 0; $j < $this->kolom; $j++){
$this->matrix[$i][$j] = "*";
}
}
}
public function showMatrix(){
echo "<table border=1 style='border-collapse: collapse;'>";
for($i = 0; $i < $this->baris; $i++){
echo "<tr>";
for($j = 0; $j < $this->kolom; $j++){
echo "<td>";
if(@$this->matrix[$i][$j] != null){
echo @$this->matrix[$i][$j];
} else {
echo "#";
}
echo "</td>";
}
echo "</tr>";
}
echo "</table>";
}
public function form1(){
echo "<form method='POST'>";
echo "input : <input type='number' value='".@$_POST['input']."' name='input' />";
echo "<input type='submit' value='submit' />";
echo "</form>";
}
public function form2(){
echo "<form method='POST'>";
echo "n 1 : <input type='number' value='".@$_POST['input']."' name='input' /><br/>";
echo "n 2 : <input type='number' value='".@$_POST['input2']."' name='input2' /><br/>";
echo "<input type='submit' value='submit' />";
echo "</form>";
}
}
/*
$jawab = new Soal4B();
$jawab->form1();
$jawab->setMatrix(@$_POST['input']);
$jawab->showMatrix();
*/