<?php interface IPrinter { function print(PrintableValue $value): void; } class PrintableValue { public readonly mixed $value; public function __construct(mixed $value) { $this->value = $value; } public function __toString() { return json_encode($this->value); } } class ConsolePrinter implements IPrinter { function print(PrintableValue $value): void { echo $value; } } $printer = new ConsolePrinter; $value = new PrintableValue(['33']); $printer->print($value);
You have javascript disabled. You will not be able to edit any code.