Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
<?php interface Shape { public function area(): float; public function perimeter(): float; public function describe(): string; } class Circle implements Shape { public function __construct(private float $radius) {} public function area(): float { return M_PI * $this->radius ** 2; } public function perimeter(): float { return 2 * M_PI * $this->radius; } public function describe(): string { return "Circle with radius {$this->radius}"; } }
Result
Open