The area is: 78.539816339745
The circumference is: 31.415926535898

Code:

<html>
<head>
<title>PHP TEST YAHHH</title>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
<body>

<div class="topbar">
<?php
include 'navbar.php';
?>
</div>

<?php
    
    // ex 13.1
    // Write an Object Oriented Program with following specifications:
    // A class circle
    // The class will contain a member variable radius
    // The class will have a constructor method, which will accept a parameter radius
    // The class will have two methods: 
    // To get a area of the circle
    // To get circumference of the circle 
    // Now instantiate a circle object, passing radius of the circle 5. Call the methods (member functions to get area and circumference)
    // Instantiate another object, passing radius 10 and calculate the area and circumference

    

    class circle
    {
    
        public $radius;
    
        public function __construct ($radius)
        {
        
            $this->radius = $radius;
        
        }
    
        public function circumference()
        {
        
            return $this->radius * 2 * M_PI;
        
        }
        
        public function area()
        {
        
            return $this->radius * $this->radius * M_PI;
        
        }
    
    }
    
    $c = new circle(5);
    //$c->setRadius(5);
    
    echo "The area is: ";
    echo $c->area();
    echo '<br>';
    
    echo "The circumference is: ";
    echo $c->circumference();
    echo '<br>';
    
    
    //echo '<br>';
    
?>

<div class="codebox">
<h3>Code:</h3>
<?php
highlight_file("ex041.php");
?>
</div>

</body>
</html>