3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyRequest { public function __construct() { $reflectedProperties = (new \ReflectionClass($this))->getProperties(); foreach ($reflectedProperties as $property) { !$property->isInitialized($this) && $property->getType()->allowsNull() ? $property->setValue($this, null) : null; } } } class PostRequest extends MyRequest { public ?string $title; public string $name; } $postRequest = new PostRequest(); $postRequest->name = 'foo'; // works fine - I have access here! foreach($postRequest as $property) { var_dump($property); }

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.130.0120.00917.89
8.4.120.0040.00520.67
8.4.110.0100.01122.58
8.4.100.0120.00817.64
8.4.90.0140.00717.88
8.4.80.0090.01017.89
8.4.70.0150.00617.83
8.4.60.0110.00918.66
8.4.50.0100.00617.53
8.4.40.0100.01017.83
8.4.30.0040.00820.52
8.4.20.0130.00717.88
8.4.10.0070.01122.50
8.3.260.0130.00616.59
8.3.250.0050.00818.84
8.3.240.0030.00516.48
8.3.230.0160.00416.71
8.3.220.0090.00717.10
8.3.210.0110.00816.80
8.3.200.0060.00318.66
8.3.190.0060.00917.01
8.3.180.0100.00716.55
8.3.170.0080.01116.96
8.3.160.0130.00718.29
8.3.150.0110.00720.51
8.3.140.0080.00820.50
8.3.130.0050.00316.72
8.3.120.0130.00718.76
8.3.110.0070.00720.94
8.3.100.0030.00624.06
8.3.90.0000.00826.77
8.3.80.0030.00619.36
8.3.70.0150.00616.58
8.3.60.0090.00918.55
8.3.50.0090.01124.46
8.3.40.0090.01218.89
8.3.30.0130.00318.84
8.3.20.0030.00624.18
8.3.10.0140.00024.66
8.3.00.0080.00026.16
8.2.290.0030.00420.65
8.2.280.0120.00718.63
8.2.270.0100.01017.37
8.2.260.0000.00816.91
8.2.250.0040.00418.55
8.2.240.0090.00618.90
8.2.230.0030.01122.58
8.2.220.0050.00337.54
8.2.210.0080.00026.77
8.2.200.0060.00318.88
8.2.190.0090.00616.58
8.2.180.0100.01025.92
8.2.170.0090.00918.88
8.2.160.0100.00322.96
8.2.150.0000.00825.66
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0100.00721.07
8.2.110.0040.00422.16
8.2.100.0090.00319.45
8.2.90.0040.00417.63
8.2.80.0040.00418.70
8.2.70.0040.00417.93
8.2.60.0000.00917.63
8.2.50.0090.00018.05
8.2.40.0040.00418.16
8.2.30.0030.00618.14
8.2.20.0040.00418.06
8.2.10.0040.00419.31
8.2.00.0000.00719.37
8.1.330.0100.00819.80
8.1.320.0050.00316.09
8.1.310.0080.00016.65
8.1.300.0060.00320.09
8.1.290.0060.00330.84
8.1.280.0100.01025.92
8.1.270.0040.00423.99
8.1.260.0050.00326.35
8.1.250.0060.00328.09
8.1.240.0170.00323.72
8.1.230.0090.00319.04
8.1.220.0000.00817.74
8.1.210.0050.00518.77
8.1.200.0040.00417.35
8.1.190.0040.00417.36
8.1.180.0080.00018.10
8.1.170.0090.00018.64
8.1.160.0030.00518.90
8.1.150.0000.00718.89
8.1.140.0000.00718.81
8.1.130.0030.00320.19
8.1.120.0080.00017.50
8.1.110.0040.00417.45
8.1.100.0030.00517.45
8.1.90.0000.00817.47
8.1.80.0000.00717.46
8.1.70.0030.00517.50
8.1.60.0040.00417.55
8.1.50.0110.00017.50
8.1.40.0040.00417.58
8.1.30.0040.00417.61
8.1.20.0030.00617.63
8.1.10.0050.00217.62
8.1.00.0040.00417.41
8.0.300.0060.00318.77
8.0.290.0080.00016.75
8.0.280.0070.00018.37
8.0.270.0030.00317.95
8.0.260.0030.00318.38
8.0.250.0060.00016.85
8.0.240.0040.00416.84
8.0.230.0000.00716.96
8.0.220.0070.00016.93
8.0.210.0070.00016.87
8.0.200.0000.00716.98
8.0.190.0050.00316.92
8.0.180.0040.00416.86
8.0.170.0050.00316.94
8.0.160.0040.00416.80
8.0.150.0040.00416.84
8.0.140.0040.00716.89
8.0.130.0060.00013.38
8.0.120.0060.00316.89
8.0.110.0000.00816.77
8.0.100.0040.00416.84
8.0.90.0000.00716.77
8.0.80.0020.01316.82
8.0.70.0070.00016.86
8.0.60.0070.00016.77
8.0.50.0040.00416.86
8.0.30.0180.00017.10
8.0.20.0070.01116.96
8.0.10.0040.00416.86
8.0.00.0170.01016.85
7.4.330.0000.00515.55
7.4.320.0000.00616.51
7.4.300.0040.00416.47
7.4.290.0030.00316.51
7.4.280.0040.00416.61
7.4.270.0000.00816.64
7.4.260.0060.00013.24
7.4.250.0040.00316.50
7.4.240.0050.00316.45
7.4.230.0030.00316.64
7.4.220.0030.00316.48
7.4.210.0080.00916.59
7.4.200.0070.00016.63
7.4.130.0080.01016.40
7.4.120.0130.01316.59
7.4.110.0120.00916.44
7.4.100.0150.00616.64
7.4.90.0120.00616.54
7.4.80.0140.00319.39
7.4.70.0080.00916.54
7.4.60.0090.01216.27
7.4.50.0110.00816.70
7.4.40.0040.01416.66
7.4.30.0100.00716.43
7.4.20.0040.01416.37
7.4.10.0220.00016.56
7.4.00.0130.00416.56
7.3.330.0030.00516.14
7.3.320.0000.00513.23
7.3.310.0030.00316.25
7.3.300.0030.00316.16
7.3.290.0070.00616.16
7.3.280.0110.00316.14
7.3.260.0080.00916.23
7.3.240.0080.00916.28
7.3.230.0120.00416.39
7.3.210.0100.01016.11
7.3.200.0130.00916.34
7.3.190.0110.00616.19
7.3.180.0070.00716.19
7.3.170.0160.00416.32
7.3.160.0400.00416.29
7.3.150.0100.00816.17
7.3.140.0110.00716.39
7.3.130.0090.00616.34
7.3.120.0190.00316.31
7.3.110.0060.00916.18
7.3.100.0130.00816.20
7.3.90.0120.00416.20
7.3.80.0130.00316.24
7.3.70.0070.01416.29
7.3.60.0170.00516.21
7.3.50.0080.00816.18
7.3.40.0060.01216.12
7.3.30.0120.00416.27
7.3.20.0590.00716.10
7.3.10.0170.00616.25
7.3.00.0070.01116.05
7.2.330.0130.00316.41
7.2.320.0200.00016.51
7.2.310.0000.01816.43
7.2.300.0060.01216.53
7.2.290.0040.01316.23
7.2.280.0070.01516.27
7.2.270.0110.00716.20
7.2.260.0090.01416.51
7.2.250.0070.01016.19
7.2.240.0090.01216.34
7.2.230.0110.00516.17
7.2.220.0100.00716.19
7.2.210.0140.00916.08
7.2.200.0080.00816.43
7.2.190.0120.01216.20
7.2.180.0080.01416.27
7.2.170.0050.01316.32
7.2.160.0130.00516.44
7.2.150.0150.00316.22
7.2.140.0160.00916.26
7.2.130.0040.01216.49
7.2.120.0000.01616.39
7.2.110.0060.01116.32
7.2.100.0160.00616.49
7.2.90.0180.00416.34
7.2.80.0120.01316.16
7.2.70.0140.00816.38
7.2.60.0130.01016.31
7.2.50.0130.01016.33
7.2.40.0110.01116.42
7.2.30.0100.01016.28
7.2.20.0130.00316.41
7.2.10.0090.00816.45
7.2.00.0080.00916.48

preferences:
29.06 ms | 403 KiB | 5 Q