3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class Foo { private $foo; public function __construct(string $foo) { $this->foo = $foo; } public function getFoo(): string { return $this->foo; } } $foo = new Foo('bar'); var_dump($foo->getFoo()); $foo->__construct('baz'); var_dump($foo->getFoo());

preferences:
113.26 ms | 402 KiB | 5 Q