forked from btcmp/bootcamp186
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
44 lines (36 loc) · 1.04 KB
/
index.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
<?php
$baris = 0;
$kolom = 0;
$data = array();
function setMatrix($input){
$GLOBALS['baris'] = $input*20;
$GLOBALS['kolom'] = $input;
for ($i=0; $i < $GLOBALS['baris']; $i++) {
# code...
for($i = 0; $i < $GLOBALS['baris']; $i++){
for ($j=0; $j < $GLOBALS['kolom']; $j++) {
# code...
if($i == $j){
$GLOBALS['data'][$i][$j] = "$i.$j";
} else {
$GLOBALS['data'][$i][$j] = "null";
}
}
}
}
}
function showMatrix(){
echo "<table>";
for($i = 0; $i < $GLOBALS['baris']; $i++){
echo "<tr>";
for ($j=0; $j < $GLOBALS['kolom']; $j++) {
# code...
echo "<td>".@$GLOBALS['data'][$i][$j]."</td>";
}
echo "</tr>";
}
echo "</table>";
}
setMatrix(5);
showMatrix();
?>