3v4l.org

run code in 300+ PHP versions simultaneously
<?php class WithPromotedProps { public function __construct( private readonly string $data = '', ) {} } // Value is initialized with empty string var_dump(new WithPromotedProps()); $ref = new ReflectionClass(WithPromotedProps::class); $instance = $ref->newInstanceWithoutConstructor(); // Value isn't initialized even with default value var_dump($instance); // // // // Fatal error because class with promoted props can't have default value: /* class GivesFatalError { private readonly string $data = ''; } */ // // // class WithoutPromotedProps { private string $data = ''; public function __construct(string $data = '') { $this->data = $data; } } $ref = new ReflectionClass(WithoutPromotedProps::class); $instance2 = $ref->newInstanceWithoutConstructor(); // Value is initialized with empty string var_dump($instance2); // // // class WithPromotedPropsButNotReadonly { public function __construct( private string $data = '', ) {} } $ref = new ReflectionClass(WithPromotedPropsButNotReadonly::class); $instance3 = $ref->newInstanceWithoutConstructor(); // Value isn't initialized even with default value var_dump($instance3);

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.4.140.0190.00417.59
8.4.130.0120.00917.77
8.4.120.0140.00620.41
8.4.110.0120.00818.88
8.4.100.0040.00617.79
8.4.90.0130.00817.82
8.4.80.0040.01019.39
8.4.70.0060.00319.22
8.4.60.0110.01017.92
8.4.50.0320.00817.53
8.4.40.0230.00717.71
8.4.30.0160.00417.44
8.4.20.0150.00417.45
8.4.10.0190.00317.54
8.3.270.0140.00516.64
8.3.260.0110.00916.81
8.3.250.0040.00518.89
8.3.240.0110.00918.62
8.3.230.0100.00916.73
8.3.220.0110.00818.41
8.3.210.0140.00616.58
8.3.200.0080.00316.61
8.3.190.0110.00616.94
8.3.180.0050.00418.96
8.3.170.0150.00516.40
8.3.160.0170.00416.58
8.3.150.0160.00516.73
8.3.140.0190.00116.56
8.3.130.0160.00316.63
8.3.120.0160.00116.36
8.3.110.0140.00516.43
8.3.100.0180.00216.47
8.3.90.0180.00416.52
8.3.80.0150.00516.18
8.3.70.0150.00516.37
8.3.60.0150.00416.70
8.3.50.0190.00316.33
8.3.40.0170.00317.24
8.3.30.0140.00317.37
8.3.20.0140.00317.43
8.3.10.0150.00417.38
8.3.00.0070.00517.48
8.2.290.0130.00520.59
8.2.280.0100.00916.50
8.2.270.0200.00816.30
8.2.260.0130.00416.43
8.2.250.0140.00316.41
8.2.240.0140.00316.77
8.2.230.0160.00116.54
8.2.220.0140.00616.23
8.2.210.0150.00216.22
8.2.200.0130.00316.56
8.2.190.0140.00316.55
8.2.180.0140.00316.53
8.2.170.0160.00117.59
8.2.160.0120.00517.20
8.2.150.0160.00317.34
8.2.140.0180.00317.27
8.2.130.0150.00517.34
8.2.120.0130.00417.51
8.2.110.0130.00517.21
8.2.100.0120.00617.28
8.2.90.0150.00717.34
8.2.80.0150.00417.41
8.2.70.0130.00517.03
8.2.60.0140.00617.32
8.2.50.0170.00317.11
8.2.40.0150.00417.53
8.2.30.0140.00417.25
8.2.20.0180.00817.31
8.2.10.0190.00517.27
8.2.00.0170.00217.40
8.1.320.0080.01116.37

preferences:
30.6 ms | 403 KiB | 5 Q