3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $untyped = 'old'; private string $typed = 'old'; public function clear() { unset($this->untyped); unset($this->typed); } public function reinitialise() { $this->typed = 'new'; $this->untyped = 'new'; } } $foo = new Foo; var_dump($foo); $foo->clear(); var_dump($foo); $foo->reinitialise(); var_dump($foo);

preferences:
50.31 ms | 402 KiB | 5 Q