3v4l.org

run code in 300+ PHP versions simultaneously
<?php function struct(string $name, array $class) { $class = json_encode($class); define($name, $class); } function create($class) { $class = json_decode($class); $array = []; foreach($class as $key => $value) { if(is_array($value)) $array += [$key => create($value)]; else $array += [$key => $value]; } return $array; } function call(array &$class, string $member, ...$args) { if(!isset($class[$member])) exit($member.' is not a member of the class.'); else { if(!is_callable($class[$member])) return $class[$member]; else { if(!isset($args[0])) $class[$member]($class); else echo('Erro'); } } } struct('myClass', [ 'foo' => 'Hello World!', 'bar' => function (&$this) { $this['foo'] = ' Hi!'; } ]); $obj = create(myClass); echo(call($obj, 'foo')); call($obj, 'bar'); call($obj, 'foo');

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.3.60.0070.01416.61
8.3.50.0070.01521.21
8.3.40.0070.00718.55
8.3.30.0060.00818.71
8.3.20.0000.00720.18
8.3.10.0000.00821.77
8.3.00.0050.00323.65
8.2.180.0150.00616.63
8.2.170.0110.00422.96
8.2.160.0110.00420.47
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0080.00021.07
8.2.120.0040.00426.35
8.2.110.0090.00021.03
8.2.100.0090.00317.68
8.2.90.0040.00419.05
8.2.80.0000.00817.97
8.2.70.0060.00317.50
8.2.60.0000.00817.80
8.2.50.0050.00318.09
8.2.40.0050.00322.37
8.2.30.0000.00819.39
8.2.20.0030.00617.57
8.2.10.0000.00817.95
8.2.00.0080.00017.87
8.1.280.0100.00325.92
8.1.270.0170.00322.06
8.1.260.0070.00028.09
8.1.250.0040.00428.09
8.1.240.0040.00422.43
8.1.230.0070.00419.15
8.1.220.0000.00817.74
8.1.210.0030.00618.77
8.1.200.0060.00317.13
8.1.190.0000.00817.10
8.1.180.0000.00818.10
8.1.170.0000.00818.58
8.1.160.0000.00820.70
8.1.150.0070.00018.77
8.1.140.0040.00419.52
8.1.130.0000.00717.58
8.1.120.0040.00317.37
8.1.110.0040.00417.35
8.1.100.0020.00517.32
8.1.90.0080.00017.36
8.1.80.0050.00217.23
8.1.70.0070.00017.34
8.1.60.0080.00017.54
8.1.50.0060.00317.36
8.1.40.0060.00317.37
8.1.30.0000.00817.55
8.1.20.0060.00317.59
8.1.10.0000.00717.35
8.1.00.0000.00817.31
8.0.300.0080.00018.77
8.0.290.0070.00016.75
8.0.280.0000.00818.45
8.0.270.0030.00317.14
8.0.260.0060.00017.18
8.0.250.0040.00416.92
8.0.240.0030.00316.88
8.0.230.0000.00716.84
8.0.220.0040.00416.89
8.0.210.0050.00216.84
8.0.200.0000.00716.84
8.0.190.0000.00816.93
8.0.180.0050.00216.75
8.0.170.0040.00416.86
8.0.160.0070.00016.86
8.0.150.0030.00616.74
8.0.140.0000.00816.72
8.0.130.0000.00613.21
8.0.120.0040.00416.79
8.0.110.0020.00516.87
8.0.100.0050.00316.73
8.0.90.0030.00316.68
8.0.80.0070.00716.86
8.0.70.0030.00516.86
8.0.60.0000.00816.88
8.0.50.0040.00416.75
8.0.30.0130.00316.94
8.0.20.0080.01117.40
8.0.10.0000.00816.84
8.0.00.0090.01116.64
7.4.330.0020.00216.83
7.4.320.0030.00316.30
7.4.300.0080.00016.40
7.4.290.0000.00716.38
7.4.280.0030.00516.50
7.4.270.0000.00716.41
7.4.260.0070.00016.31
7.4.250.0000.00716.38
7.4.240.0040.00416.31
7.4.230.0070.00016.47
7.4.220.0030.01316.35
7.4.210.0110.00416.48
7.4.200.0040.00316.39
7.4.160.0140.00316.34
7.4.150.0090.00917.40
7.4.140.0120.01117.86
7.4.130.0110.00816.41
7.4.120.0090.00916.56
7.4.110.0040.01516.30
7.4.100.0100.00716.36
7.4.90.0070.01016.51
7.4.80.0000.01619.39
7.4.70.0140.00316.30
7.4.60.0100.00716.37
7.4.50.0060.01016.53
7.4.40.0120.00916.39
7.4.30.0030.01916.28
7.4.00.0040.01414.86
7.3.330.0060.00013.12
7.3.320.0030.00313.23
7.3.310.0040.00416.16
7.3.300.0070.00016.28
7.3.290.0050.01016.27
7.3.280.0110.00716.23
7.3.270.0100.00717.40
7.3.260.0120.00616.50
7.3.250.0080.01016.29
7.3.240.0100.01216.47
7.3.230.0140.00316.39
7.3.210.0100.01316.21
7.3.200.0120.01219.39
7.3.190.0100.00616.36
7.3.180.0070.01116.39
7.3.170.0100.01216.29
7.3.160.0060.00916.53
7.3.10.0140.00316.41
7.3.00.0190.00616.22
7.2.330.0030.01316.41
7.2.320.0060.01816.25
7.2.310.0090.00916.23
7.2.300.0060.01216.19
7.2.290.0100.00716.24
7.2.130.0070.00716.20
7.2.120.0150.00416.36
7.2.110.0090.00616.46
7.2.100.0130.00316.66
7.2.90.0070.01016.58
7.2.80.0040.01116.35
7.2.70.0030.01016.70
7.2.60.0070.01016.59
7.2.50.0070.00716.31
7.2.40.0130.00016.74
7.2.30.0000.01516.64
7.2.20.0170.00716.55
7.2.10.0130.00716.63
7.2.00.0160.00217.77
7.1.250.0090.00415.39
7.1.200.0030.00915.69
7.1.100.0030.01018.06
7.1.70.0040.00417.09
7.1.60.0160.00919.40
7.1.50.0040.00816.90
7.1.00.0070.07322.33
7.0.200.0030.00616.43
7.0.90.0030.08319.97
7.0.80.0030.07319.92
7.0.70.0500.05319.99
7.0.60.0430.06019.99
7.0.50.0630.08320.44
7.0.40.0130.07319.96
7.0.30.0030.08020.18
7.0.20.0170.07720.12
7.0.10.0100.06020.09
7.0.00.0000.05019.92
5.6.280.0000.03320.99
5.6.240.0100.08320.52
5.6.230.0100.07320.73
5.6.220.0100.07320.68
5.6.210.0130.06020.61
5.6.200.0100.06321.07
5.6.190.0100.07721.10
5.6.180.0100.07321.11
5.6.170.0100.07721.14
5.6.160.0100.04321.09
5.6.150.0130.07321.11
5.6.140.0100.08021.11
5.6.130.0030.06021.02
5.6.120.0030.06320.89
5.6.110.0030.08721.08
5.6.100.0130.07021.02
5.6.90.0070.08021.00
5.6.80.0030.07320.35
5.6.70.0130.05320.55
5.6.60.0130.05020.48
5.6.50.0030.07720.50
5.6.40.0030.08720.45
5.6.30.0100.07720.44
5.6.20.0100.07320.46
5.6.10.0030.05020.39
5.6.00.0030.07320.31
5.5.380.0030.08020.42
5.5.370.0070.09020.40
5.5.360.0070.05020.35
5.5.350.0200.06020.34
5.5.340.0100.04720.89
5.5.330.0070.08020.89
5.5.320.0070.05020.83
5.5.310.0030.09020.86
5.5.300.0070.08320.81
5.5.290.0130.07720.92
5.5.280.0000.07720.93
5.5.270.0030.07020.87
5.5.260.0100.08020.79
5.5.250.0100.05020.68
5.5.240.0100.06720.12
5.5.230.0170.07020.03
5.5.220.0070.07320.21
5.5.210.0030.06720.11
5.5.200.0030.06320.26
5.5.190.0030.06720.24
5.5.180.0030.08020.12
5.5.160.0030.05320.27
5.5.150.0070.04020.28
5.5.140.0100.03720.13
5.5.130.0030.08020.11
5.5.120.0030.04720.20
5.5.110.0100.06320.27
5.5.100.0070.08020.08
5.5.90.0070.05020.15
5.5.80.0030.04020.05
5.5.70.0100.03320.13
5.5.60.0100.04720.15
5.5.50.0070.08320.11
5.5.40.0070.04320.16
5.5.30.0100.07020.05
5.5.20.0100.03719.96
5.5.10.0070.04319.98
5.5.00.0130.07320.00

preferences:
41.66 ms | 401 KiB | 5 Q