3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private function __construct() {} public function test() { print("Hey, I'm an instance of class A!"); } } $reflClass = new ReflectionClass(A::class); $instance = $reflClass->newInstanceWithoutConstructor(); $instance->test();
Output for 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.14, 8.4.1
Hey, I'm an instance of class A!

preferences:
45.16 ms | 406 KiB | 5 Q