Webbserverprogrammering 1

Show sourcecode

The following files exists in this folder. Click to view.

webbsrvprg/exercises/ovning8/

index.html
ovn_kls1.php
ovn_kls2.php
ovn_kls3.php
ovn_kls4.php
ovn_kls5.php
ovn_kls6.php

ovn_kls2.php

31 lines UTF-8 Windows (CRLF)
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
</body>
<?php
class Ball {
    public 
$namn;
    public 
$radie;
    public 
$color;
    public function 
__construct($namn$radie$color) {
      
$this->namn $namn;
      
$this->radie $radie;
      
$this->color $color;
    }
    public function 
mataut() {
      return 
$this->namn" har radien "$this->radie" och färgen "$this->color"<br>";
    }
}
$enboll = new Ball("enboll","10 cm""grön");
echo 
$enboll->mataut();
$boll2 = new Ball("boll2" ,"14 cm""orange");
echo 
$boll2->mataut();
$boll3 = new Ball"boll3","200 cm""blå");
echo 
$boll3->mataut();
?>
</html>