Skip to content

Circle area

PHP class method

Same task in: C++Go

Flowchart (ISO 5807)

StartReturn 3.14159·this.r·this.rEndFigure 1 — Circle.area

Source code

PHP
class Circle {
    public $r;
    public function area() {
        return 3.14159 * $this->r * $this->r;
    }
}

The editor opens with this code — change it and the chart redraws.

Language
PHP
Constructs
class method
Topic
Classes & methods
Formats
Word, Visio, draw.io, PDF, SVG

Related examples