-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.php
62 lines (56 loc) · 1.39 KB
/
example.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
59
60
61
62
<html>
<head>
<title>Geometrie-Klasse Beispiel</title>
<meta charset="UTF-8" />
<style>
body {
font-family: Arial;
}
th{
text-align: left;
width: 150px;
}
td{
text-align: right;
width: 150px;
}
h2{
border-bottom: 1px solid #ddd;
border-top: 1px solid #ddd;
padding: 5px 0;
margin-top: 30px;
}
</style>
</head>
<body>
<h1>Beispiel Geometrie-Klassen</h1>
<p>Siehe den PHP-Quellcode dieser Seite an, um zu verstehen, was hier demonstriert wird.</p>
<?php
//Das ist der Kreiss Nummer eins
$Kreis = new Kreis;
$Kreis->setUmfang(100);
print '<h2>Kreis</h2>';
print '<table>';
print '<tr><th>Radius</th><td>'.$Kreis->getRadius().'</td></tr>';
print '<tr><th>Fläche</th><td>'.$Kreis->getFlaeche().'</td></tr>';
print '<tr><th>Durchmesser</th><td>'.$Kreis->getDurchmesser().'</td></tr>';
print '<tr><th>Umfang</th><td>'.$Kreis->getUmfang().'</td></tr>';
print '</table>';
//Schoenes Wetter
//Quadrat
$Quadrat = new Quadrat;
$Quadrat->setSeitenlaenge(5);
print '<h2>Quadrat</h2>';
print '<table>';
print '<tr><th>Diagonale</th><td>'.$Quadrat->getDiagonale().'</td></tr>';
print '<tr><th>Fläche</th><td>'.$Quadrat->getFlaeche().'</td></tr>';
print '<tr><th>Umfang</th><td>'.$Quadrat->getUmfang().'</td></tr>';
print '<tr><th>Seitenlänge</th><td>'.$Quadrat->getSeitenlaenge().'</td></tr>';
print '</table>';
//Autoload-Klasse
function __autoload($class){
include_once "classes/$class.php";
}
?>
</body>
</html>