3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Something { private $value; private function __construct($value) { $this->value = $value; } public static function create($value) { return new static($value); } public function __toString() { return $this->value; } } var_dump(strval(Something::create("hallo")));

preferences:
38.08 ms | 402 KiB | 5 Q