Show sourcecode
The following files exists in this folder. Click to view.
hej.php
hej.py
index.php
mysqlintro_1.php
ovn_cookie1.php
ovn_cookie2.php
ovn_cookie3_1.php
ovn_cookie3_2.php
ovn_cookie4.php
ovn_cookie5.php
ovn_cookie6.php
ovn_form1.php
ovn_form2.php
ovn_form3_1.php
ovn_form3_2.php
ovn_form7_1.php
ovn_form7_2.php
ovn_form8_1.php
ovn_form_tillamp1_1.php
ovn_form_tillamp1_2.php
ovn_form_tillamp2.php
ovn_form_tillamp3.php
ovn_form_tillamp4.php
ovn_form_tillamp5.php
ovn_form_tillamp6.php
ovn_funk1.php
ovn_funk2.php
ovn_funk3.php
ovn_funk4.php
ovn_funk5.php
ovn_funk6.php
ovn_funk7.php
ovn_funk8.php
ovn_funk9.php
ovn_gr1.php
ovn_gr2.php
ovn_gr3.php
ovn_gr4.php
ovn_gr5.php
ovn_gr6.php
ovn_gr7.php
ovn_incl1/
ovn_incl2/
ovn_incl3/
ovn_klass1.php
ovn_klass2.php
ovn_klass3.php
ovn_klass4.php
ovn_klass5.php
ovn_klass6.php
ovn_klass7.php
ovn_mysqlintro1_1.php
ovn_mysqlintro1_2.php
ovn_str1_1.php
ovn_str1_2.php
ovn_str2_1.php
ovn_str2_2.php
ovn_str3_1.php
ovn_str3_2.php
ovn_str4_1.php
ovn_str4_2.php
ovn_str5_1.php
ovn_str5_2.php
ovn_str6_1.php
ovn_str6_2.php
ovn_klass7.php
83 lines UTF-8 Windows (CRLF)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>klasser</title>
</head>
<body>
<?php
class Boll {
private $farg;
private $radie;
private static $balls = 0;
public function __construct($n, $m) {
$this->farg = $n;
$this->radie = $m;
self::$balls++;
}
public static function getBalls() {
return self::$balls;
}
public function getFarg() {
return $this->farg;
}
public function getRadie() {
return $this->radie;
}
public function getBall() {
return $this;
}
}
class Fotboll extends Boll {
private $vikt;
public function __construct($n, $m, $l) {
parent:: __construct($n, $m);
$this->vikt = $l;
}
public function getVikt() {
return $this->vikt;
}
}
class Studsboll extends Boll {
private $studs;
public function __construct($n, $m, $l) {
parent:: __construct($n, $m);
$this->studs = $l;
}
public function getStuds() {
return $this->studs;
}
}
$boll1 = new Boll("blå", 5);
$boll2 = new Fotboll("röd", 10, 1);
$boll3 = new Studsboll("grön", 15, "mycket");
$array = [$boll1->getBall(), $boll2->getBall(), $boll3->getBall()];
print_r($array) ;
echo "<br>antal bollar: ".Boll::getBalls();
// echo "boll2 har färgen ".$boll2->getFarg()." och radien ".$boll2->getRadie()." och vikten ".$boll2->getVikt()." kg"."<br>";
// echo "boll3 har färgen ".$boll3->getFarg()." och radien ".$boll3->getRadie()." och ".$boll3->getStuds()." studs"."<br>";
?>
</body>
</html>