Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
<?php interface Printable { public function print(): void; } interface Exportable { public function toArray(): array; public function toJson(): string; } interface Cacheable { public function getCacheKey(): string; } class Invoice implements Printable, Exportable, Cacheable { public function print(): void { echo "Invoice #1"; } public function toArray(): array { return ["id" => 1]; } public function toJson(): string { return json_encode($this->toArray()); } public function getCacheKey(): string { return "invoice:1"; } }
Result
Open