3v4l.org

run code in 300+ PHP versions simultaneously
<?php class IAmImmutable { private $name; private function __construct($name) { $this->name = $name; } public function getName() { return $this->name; } } $object = new IAmImmutable('Peter'); var_dump($object->getName()); $object->__construct('Bob'); var_dump($object->getName());

preferences:
35.87 ms | 402 KiB | 5 Q