3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class Thing { public function __construct(public readonly string $something) {} public function withSomething(string $something): self { $instance = clone $this; $instance->something = $something; return $instance; } } $thing = new Thing('hello'); $thing = $thing->withSomething('goodbye');

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
183.37 ms | 1610 KiB | 8 Q