3v4l.org

run code in 300+ PHP versions simultaneously
<?php class User {} class Example { public User $user; public function __construct(User $user) { $this->user = $user; } } $class = new ReflectionClass(Example::class); $object = $class->newInstanceArgs(['User' => new User]);
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.14
Fatal error: Uncaught Error: Unknown named parameter $User in /in/QU4jS:14 Stack trace: #0 /in/QU4jS(14): ReflectionClass->newInstanceArgs(Array) #1 {main} thrown in /in/QU4jS on line 14
Process exited with code 255.
Output for 7.4.0 - 7.4.33

preferences:
72.72 ms | 407 KiB | 5 Q