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) { $object = (array) json_decode($class); //if(function_exists($object['__construct']())) $object['__construct']($object); return $object; } function call(array &$class, string $member, ...$args) { if(!isset($class[$member])) exit($member.' is not a member of the class.'); else { if(!isset($args[0])) call_user_func($class[$member]($class)); else call_user_func($class[$member]($class, $args)); } } struct('myStruct', [ 'foo' => 'Hello World!', 'bar' => function (array &$this) { echo(' Hi!'); } ]); $obj = create(myStruct); call($obj, 'bar');

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.00716.75
8.3.50.0070.00716.11
8.3.40.0110.00418.67
8.3.30.0060.00918.68
8.3.20.0040.00420.16
8.3.10.0050.00221.58
8.3.00.0000.00823.63
8.2.180.0120.00618.29
8.2.170.0110.01122.96
8.2.160.0140.00020.39
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0030.00520.95
8.2.120.0040.00426.35
8.2.110.0090.00020.88
8.2.100.0040.00717.72
8.2.90.0060.00318.09
8.2.80.0000.00918.03
8.2.70.0060.00317.68
8.2.60.0030.00617.91
8.2.50.0030.00618.10
8.2.40.0050.00320.55
8.2.30.0040.00419.23
8.2.20.0060.00317.62
8.2.10.0040.00417.88
8.2.00.0040.00417.95
8.1.280.0140.00725.92
8.1.270.0040.00422.11
8.1.260.0070.00028.09
8.1.250.0040.00428.09
8.1.240.0060.00322.39
8.1.230.0090.00320.89
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0000.00817.22
8.1.190.0040.00417.00
8.1.180.0080.00018.10
8.1.170.0060.00318.59
8.1.160.0000.00822.19
8.1.150.0080.00018.77
8.1.140.0000.00819.39
8.1.130.0000.00717.59
8.1.120.0000.00717.39
8.1.110.0000.00817.36
8.1.100.0030.00517.25
8.1.90.0040.00417.34
8.1.80.0040.00417.35
8.1.70.0000.00817.25
8.1.60.0000.00917.49
8.1.50.0050.00317.41
8.1.40.0040.00417.28
8.1.30.0030.00517.55
8.1.20.0050.00517.51
8.1.10.0040.00417.43
8.1.00.0000.00717.33
8.0.300.0070.00019.81
8.0.290.0000.00716.63
8.0.280.0050.00318.30
8.0.270.0000.00917.21
8.0.260.0050.00317.14
8.0.250.0070.00016.85
8.0.240.0030.00316.80
8.0.230.0030.00316.86
8.0.220.0030.00316.85
8.0.210.0000.00716.85
8.0.200.0030.00316.87
8.0.190.0030.00616.97
8.0.180.0040.00416.78
8.0.170.0040.00416.77
8.0.160.0050.00316.74
8.0.150.0110.00016.85
8.0.140.0040.00416.64
8.0.130.0040.00413.29
8.0.120.0000.00816.79
8.0.110.0080.00016.84
8.0.100.0000.00716.73
8.0.90.0080.00016.72
8.0.80.0060.01016.84
8.0.70.0040.00416.83
8.0.60.0040.00416.91
8.0.50.0030.00616.84
8.0.30.0140.00517.00
8.0.20.0080.01017.40
8.0.10.0040.00416.96
8.0.00.0130.00516.70
7.4.330.0050.00016.89
7.4.320.0030.00316.54
7.4.300.0040.00416.39
7.4.290.0000.00716.34
7.4.280.0050.00316.28
7.4.270.0030.00316.48
7.4.260.0030.00316.37
7.4.250.0060.00316.49
7.4.240.0000.00816.33
7.4.230.0050.00216.30
7.4.220.0040.01616.52
7.4.210.0070.00816.46
7.4.200.0030.00316.51
7.4.160.0060.00916.17
7.4.150.0150.00917.40
7.4.140.0080.01317.86
7.4.130.0120.00716.41
7.4.120.0120.00516.39
7.4.110.0100.00716.19
7.4.100.0060.01016.43
7.4.90.0100.00916.38
7.4.80.0100.01319.39
7.4.70.0100.00716.62
7.4.60.0090.00616.20
7.4.50.0090.00616.33
7.4.40.0120.00616.47
7.4.30.0100.01016.55
7.4.00.0040.01115.00
7.3.330.0030.00313.22
7.3.320.0030.00313.20
7.3.310.0030.00316.31
7.3.300.0030.00316.23
7.3.290.0000.00716.24
7.3.280.0070.00916.24
7.3.270.0110.00717.40
7.3.260.0070.01016.49
7.3.250.0100.00816.17
7.3.240.0120.00716.33
7.3.230.0150.00316.39
7.3.210.0170.00016.16
7.3.200.0070.01419.39
7.3.190.0180.00316.36
7.3.180.0100.01016.13
7.3.170.0130.01016.27
7.3.160.0090.00616.27
7.2.330.0130.00316.17
7.2.320.0110.00716.53
7.2.310.0130.01016.25
7.2.300.0110.00916.51
7.2.290.0060.01316.34
7.2.60.0100.00616.79
7.2.00.0070.00719.10
7.1.200.0030.00915.22
7.1.100.0030.01017.93
7.1.70.0030.00616.84
7.1.60.0170.00719.40
7.1.50.0100.01016.85
7.1.00.0000.08022.32
7.0.200.0000.00816.32
7.0.90.0030.04019.95
7.0.80.0030.03319.89
7.0.70.0030.03319.91
7.0.60.0000.04019.93
7.0.50.0030.04320.32
7.0.40.0030.04719.95
7.0.30.0030.04320.10
7.0.20.0070.03319.95
7.0.10.0100.03720.00
7.0.00.0100.04320.18
5.6.280.0070.05320.96
5.6.230.0030.04020.55
5.6.220.0000.04720.62
5.6.210.0000.05320.39
5.6.200.0030.04321.06
5.6.190.0100.03721.12
5.6.180.0030.03720.95
5.6.170.0130.07321.07
5.6.160.0030.08721.02
5.6.150.0070.07721.09
5.6.140.0070.07721.04
5.6.130.0070.04720.99
5.6.120.0200.06021.18
5.6.110.0030.09720.96
5.6.100.0130.06721.04
5.6.90.0100.07720.92
5.6.80.0130.06020.56
5.6.70.0070.04320.34
5.6.60.0100.06020.33
5.6.50.0070.08320.35
5.6.40.0200.07020.53
5.6.30.0100.07320.32
5.6.20.0030.08020.41
5.6.10.0070.08020.53
5.6.00.0030.08020.39
5.5.370.0000.05020.45
5.5.360.0070.04020.30
5.5.350.0000.06720.33
5.5.340.0030.03720.80
5.5.330.0030.04720.74
5.5.320.0100.03020.80
5.5.310.0070.08020.87
5.5.300.0070.05320.77
5.5.290.0030.05020.83
5.5.280.0130.04320.86
5.5.270.0100.04320.88
5.5.260.0170.04720.79
5.5.250.0070.07720.70
5.5.240.0170.07020.21
5.5.230.0170.07019.97
5.5.220.0070.07720.15
5.5.210.0130.06720.16
5.5.200.0100.08020.22
5.5.190.0100.05020.29
5.5.180.0070.07020.11
5.5.160.0070.04320.24
5.5.150.0170.04320.27
5.5.140.0070.04320.23
5.5.130.0070.07320.23
5.5.120.0100.03720.27
5.5.110.0100.04020.14
5.5.100.0000.08320.18
5.5.90.0170.05720.10
5.5.80.0100.07320.17
5.5.70.0130.06719.96
5.5.60.0100.04020.06
5.5.50.0100.05720.06
5.5.40.0100.06320.00
5.5.30.0100.06720.15
5.5.20.0000.05720.03
5.5.10.0000.05320.09
5.5.00.0070.08020.00

preferences:
64.47 ms | 401 KiB | 5 Q