Show sourcecode
The following files exists in this folder. Click to view.
webbsrvprg/exercises/klasserochobjekt/
index.php
ovn_ko1 copy.php
ovn_ko1.php
ovn_ko2.php
ovn_ko3.php
ovn_ko4.php
ovn_ko5.php
ovn_ko7.php
ovn_ko1.php
34 lines UTF-8 Windows (CRLF)
<?php
error_reporting(-1); // Report all type of errors
ini_set('display_errors', 1); // Display all errors
ini_set('output_buffering', 0); // Do not buffer outputs, write directly
?>
<!DOCTYPE html>
<html lang="sv">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>KLASSER</title>
</head>
<body>
<?php
class boll {
public $color;
public $radius;
function __construct($color, $radius){
$this->color = $color;
$this->radius = $radius;
}
function getInfo(){
return("Den här bollen är $this->color och har radien $this->radius <br>");
}
}
$min_boll = new boll("lila", 2);
echo($min_boll->getInfo());
?>
</body>
</html>