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.00818.13
8.4.120.0110.00920.52
8.4.110.0120.00819.02
8.4.100.0140.00718.15
8.4.90.0120.00918.03
8.4.80.0110.00918.20
8.4.70.0060.00318.20
8.4.60.0090.01120.48
8.4.50.0130.00917.79
8.4.40.0100.01017.77
8.4.30.0130.00620.58
8.4.20.0070.01317.73
8.4.10.0080.00022.30
8.3.260.0100.00916.93
8.3.250.0080.00620.90
8.3.240.0150.00416.52
8.3.230.0090.00916.93
8.3.220.0110.00918.85
8.3.210.0100.00716.51
8.3.200.0110.00916.60
8.3.190.0100.00917.27
8.3.180.0120.00616.61
8.3.170.0130.00616.54
8.3.160.0140.00418.78
8.3.150.0040.01417.01
8.3.140.0110.00716.69
8.3.130.0080.00016.60
8.3.120.0120.00318.92
8.3.110.0200.00016.75
8.3.100.0040.00724.06
8.3.90.0060.00926.77
8.3.80.0030.00619.36
8.3.70.0090.00916.58
8.3.60.0170.00318.68
8.3.50.0100.01024.40
8.3.40.0110.01118.84
8.3.30.0070.00718.82
8.3.20.0080.00024.18
8.3.10.0040.00424.66
8.3.00.0070.00026.16
8.2.290.0040.00420.69
8.2.280.0050.00518.70
8.2.270.0070.01416.95
8.2.260.0110.00718.77
8.2.250.0080.00016.73
8.2.240.0060.00318.70
8.2.230.0060.00320.94
8.2.220.0130.00337.54
8.2.210.0090.00626.77
8.2.200.0060.00318.88
8.2.190.0090.00617.00
8.2.180.0140.00325.92
8.2.170.0060.01318.76
8.2.160.0070.00722.96
8.2.150.0040.00425.66
8.2.140.0000.00824.66
8.2.130.0080.00026.16
8.2.120.0060.00326.35
8.2.110.0040.00420.49
8.2.100.0140.00017.97
8.2.90.0080.00017.91
8.2.80.0050.00317.97
8.2.70.0060.00317.93
8.2.60.0080.00018.09
8.2.50.0040.00418.10
8.2.40.0000.00919.48
8.2.30.0040.00417.98
8.2.20.0000.00817.97
8.2.10.0000.00719.20
8.2.00.0040.00419.38
8.1.330.0110.01016.65
8.1.320.0120.00720.34
8.1.310.0120.00616.79
8.1.300.0060.00320.12
8.1.290.0060.00330.84
8.1.280.0100.00725.92
8.1.270.0070.01123.90
8.1.260.0090.00628.09
8.1.250.0040.00428.09
8.1.240.0060.00617.39
8.1.230.0080.00321.04
8.1.220.0000.00917.79
8.1.210.0050.00318.97
8.1.200.0030.00617.35
8.1.190.0000.00817.35
8.1.180.0080.00018.10
8.1.170.0040.00418.39
8.1.160.0000.00818.79
8.1.150.0050.00219.03
8.1.140.0070.00018.92
8.1.130.0000.00720.23
8.1.120.0000.00817.39
8.1.110.0030.00517.43
8.1.100.0030.00317.50
8.1.90.0000.00717.47
8.1.80.0040.00417.49
8.1.70.0030.00617.49
8.1.60.0040.00417.61
8.1.50.0000.00917.59
8.1.40.0040.00417.43
8.1.30.0030.00517.70
8.1.20.0000.00817.71
8.1.10.0070.00017.51
8.1.00.0000.00817.50
8.0.300.0050.00219.71
8.0.290.0050.00316.75
8.0.280.0000.00718.54
8.0.270.0030.00318.11
8.0.260.0000.00618.43
8.0.250.0040.00417.06
8.0.240.0000.01017.07
8.0.230.0040.00416.95
8.0.220.0030.00316.90
8.0.210.0000.00717.02
8.0.200.0070.00017.05
8.0.190.0000.00716.93
8.0.180.0050.00316.96
8.0.170.0040.00417.09
8.0.160.0040.00416.97
8.0.150.0050.00317.02
8.0.140.0080.00016.90
8.0.130.0000.00513.41
8.0.120.0000.00716.84
8.0.110.0030.00617.02
8.0.100.0000.00816.80
8.0.90.0040.00416.86
8.0.80.0070.00716.96
8.0.70.0060.00316.77
8.0.60.0000.00716.80
8.0.50.0030.00516.87
8.0.30.0170.00416.87
8.0.20.0110.01117.16
8.0.10.0000.00817.11
8.0.00.0110.00817.02
7.4.330.0050.00015.55
7.4.320.0030.00316.67
7.4.300.0060.00016.53
7.4.290.0040.00416.59
7.4.280.0040.00416.44
7.4.270.0030.00316.59
7.4.260.0030.00313.32
7.4.250.0030.00316.63
7.4.240.0030.00316.62
7.4.230.0040.00416.63
7.4.220.0040.00316.49
7.4.210.0080.00816.51
7.4.200.0000.00716.63
7.4.130.0100.01016.57
7.4.120.0060.01216.41
7.4.110.0030.01316.52
7.4.100.0040.01216.63
7.4.90.0070.01016.53
7.4.80.0130.01019.39
7.4.70.0140.00816.64
7.4.60.0100.01316.24
7.4.50.0100.01016.58
7.4.40.0120.01116.46
7.4.30.0130.00516.63
7.4.20.0100.01016.44
7.4.10.0110.01116.59
7.4.00.0090.01216.46
7.3.330.0040.00416.01
7.3.320.0030.00313.07
7.3.310.0030.00316.27
7.3.300.0060.00016.08
7.3.290.0090.00616.23
7.3.280.0040.01116.11
7.3.260.0080.01116.24
7.3.240.0110.00716.34
7.3.230.0070.01016.22
7.3.210.0110.01116.19
7.3.200.0070.01116.21
7.3.190.0240.00316.24
7.3.180.0130.00916.19
7.3.170.0140.00416.15
7.3.160.0030.01816.20
7.3.150.0060.01716.33
7.3.140.0090.01216.23
7.3.130.0090.01016.16
7.3.120.0070.01116.14
7.3.110.0120.00916.09
7.3.100.0030.01516.19
7.3.90.0090.00616.18
7.3.80.0080.01216.15
7.3.70.0100.00716.12
7.3.60.0080.00816.15
7.3.50.0090.00916.20
7.3.40.0100.00816.18
7.3.30.0090.00916.24
7.3.20.0130.00516.11
7.3.10.0040.01116.16
7.3.00.0090.00916.24
7.2.330.0130.00416.30
7.2.320.0100.01016.23
7.2.310.0030.01616.30
7.2.300.0130.01016.23
7.2.290.0100.01316.37
7.2.280.0090.01116.32
7.2.270.0100.01016.36
7.2.260.0090.01116.33
7.2.250.0090.00916.30
7.2.240.0070.01116.44
7.2.230.0130.00416.29
7.2.220.0070.01016.50
7.2.210.0120.00316.42
7.2.200.0080.01316.33
7.2.190.0170.00016.24
7.2.180.0150.00016.45
7.2.170.0100.01016.39
7.2.160.0040.01416.36
7.2.150.0060.01216.44
7.2.140.0030.01416.59
7.2.130.0060.01216.32
7.2.120.0130.00516.47
7.2.110.0150.00416.48
7.2.100.0060.01016.42
7.2.90.0040.01516.38
7.2.80.0070.01016.24
7.2.70.0100.01016.28
7.2.60.0060.01216.45
7.2.50.0080.00916.39
7.2.40.0100.00716.39
7.2.30.0140.00716.50
7.2.20.0100.00716.18
7.2.10.0070.01016.40
7.2.00.0060.01216.43

preferences:
28.61 ms | 403 KiB | 5 Q