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 = 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(!is_callable($class[$member])) return $class[$member]; else { if(!isset($args[0])) $class[$member]($class); } } } struct('myStruct', [ 'foo' => 'Hello World!', 'bar' => function (&$this) { $this['foo'] = ' Hi!'; }, '__construct' => function (&$this) { echo('Test'); } ]); $obj = create(myStruct); echo(call($obj, 'foo')); call($obj, 'bar'); echo(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.01116.38
8.3.50.0070.01221.07
8.3.40.0120.00618.70
8.3.30.0100.01018.54
8.3.20.0040.00420.20
8.3.10.0040.00421.85
8.3.00.0050.00323.65
8.2.180.0090.00616.88
8.2.170.0120.00322.96
8.2.160.0070.00720.52
8.2.150.0000.00824.18
8.2.140.0030.00524.66
8.2.130.0030.00521.13
8.2.120.0080.00026.35
8.2.110.0000.00921.12
8.2.100.0060.00617.92
8.2.90.0000.00818.92
8.2.80.0030.00617.97
8.2.70.0000.00917.38
8.2.60.0000.00717.80
8.2.50.0030.00618.09
8.2.40.0000.00720.42
8.2.30.0060.00319.38
8.2.20.0060.00317.64
8.2.10.0040.00418.04
8.2.00.0040.00417.82
8.1.280.0040.01125.92
8.1.270.0100.01022.23
8.1.260.0050.00228.09
8.1.250.0050.00228.09
8.1.240.0030.00622.30
8.1.230.0050.00519.09
8.1.220.0000.00917.74
8.1.210.0060.00318.77
8.1.200.0040.00417.23
8.1.190.0080.00017.10
8.1.180.0090.00018.10
8.1.170.0080.00018.66
8.1.160.0050.00220.70
8.1.150.0040.00418.77
8.1.140.0030.00519.43
8.1.130.0030.00317.65
8.1.120.0030.00317.33
8.1.110.0030.00317.22
8.1.100.0050.00317.25
8.1.90.0030.00617.21
8.1.80.0050.00317.38
8.1.70.0070.00017.33
8.1.60.0030.00617.47
8.1.50.0060.00317.29
8.1.40.0040.00417.42
8.1.30.0000.00817.52
8.1.20.0080.00017.48
8.1.10.0000.00817.46
8.1.00.0030.00617.35
8.0.300.0030.00618.77
8.0.290.0000.00716.63
8.0.280.0040.00218.26
8.0.270.0040.00417.07
8.0.260.0000.00617.14
8.0.250.0030.00316.88
8.0.240.0030.00316.93
8.0.230.0050.00316.84
8.0.220.0040.00416.74
8.0.210.0070.00016.91
8.0.200.0000.00616.95
8.0.190.0080.00016.85
8.0.180.0070.00016.90
8.0.170.0070.00016.76
8.0.160.0040.00316.93
8.0.150.0070.00016.78
8.0.140.0040.00416.70
8.0.130.0050.00013.28
8.0.120.0040.00416.81
8.0.110.0040.00416.82
8.0.100.0000.00716.73
8.0.90.0040.00416.89
8.0.80.0060.00916.84
8.0.70.0030.00516.80
8.0.60.0030.00616.73
8.0.50.0080.00016.66
8.0.30.0060.01016.97
8.0.20.0060.01217.40
8.0.10.0050.00316.82
8.0.00.0110.00916.72
7.4.330.0020.00216.74
7.4.320.0060.00016.52
7.4.300.0000.00716.54
7.4.290.0030.00616.50
7.4.280.0050.00316.38
7.4.270.0070.00016.47
7.4.260.0000.00816.43
7.4.250.0040.00416.48
7.4.240.0000.00716.48
7.4.230.0070.00016.29
7.4.220.0180.00316.52
7.4.210.0060.00916.42
7.4.200.0000.00716.47
7.4.160.0150.00816.48
7.4.150.0070.01117.40
7.4.140.0130.00817.86
7.4.130.0090.01216.36
7.4.120.0090.00916.43
7.4.110.0100.00716.39
7.4.100.0090.00916.51
7.4.90.0120.00616.39
7.4.80.0120.00619.39
7.4.70.0130.00316.39
7.4.60.0110.00516.41
7.4.50.0070.01016.32
7.4.40.0110.00516.38
7.4.30.0080.01616.36
7.4.10.0070.01315.09
7.4.00.0070.01014.92
7.3.330.0030.00313.12
7.3.320.0000.00613.09
7.3.310.0040.00416.15
7.3.300.0000.00716.27
7.3.290.0090.00916.23
7.3.280.0060.01216.26
7.3.270.0100.00717.40
7.3.260.0150.01216.36
7.3.250.0130.00816.40
7.3.240.0080.01016.36
7.3.230.0070.01016.39
7.3.210.0130.01016.32
7.3.200.0120.00819.39
7.3.190.0110.00716.49
7.3.180.0070.01016.47
7.3.170.0050.01316.27
7.3.160.0030.01316.38
7.3.130.0060.01314.56
7.3.120.0070.01214.67
7.3.110.0060.01014.57
7.3.100.0050.00914.70
7.3.90.0050.00914.74
7.3.80.0040.00814.80
7.3.70.0030.01014.44
7.3.60.0060.00914.65
7.3.50.0050.00814.62
7.3.40.0070.00514.68
7.3.30.0060.00714.62
7.3.20.0090.00516.58
7.3.10.0040.01016.38
7.3.00.0080.00616.37
7.2.330.0090.00916.17
7.2.320.0090.00916.29
7.2.310.0110.01116.48
7.2.300.0120.00816.35
7.2.290.0090.00916.36
7.2.260.0090.01315.10
7.2.250.0110.00414.88
7.2.240.0050.01314.81
7.2.230.0070.00714.68
7.2.220.0070.00914.82
7.2.210.0070.00514.81
7.2.200.0060.00614.85
7.2.190.0060.00714.82
7.2.180.0070.00814.71
7.2.170.0040.00914.79
7.2.160.0060.00914.63
7.2.150.0020.01216.73
7.2.140.0050.01116.87
7.2.130.0060.01016.74
7.2.120.0080.00816.65
7.2.110.0000.01316.72
7.2.100.0060.00916.68
7.2.90.0040.01016.61
7.2.80.0090.00516.66
7.2.70.0080.00616.71
7.2.60.0060.01016.66
7.2.50.0060.00716.53
7.2.40.0070.00616.69
7.2.30.0060.00816.86
7.2.20.0050.01016.79
7.2.10.0050.00816.58
7.2.00.0030.00917.61
7.1.330.0070.00715.72
7.1.320.0030.01215.42
7.1.310.0060.00615.41
7.1.300.0060.00715.55
7.1.290.0050.00815.57
7.1.280.0040.01015.34
7.1.270.0060.01015.58
7.1.260.0050.01015.53
7.1.250.0090.00615.64
7.1.240.0070.01015.61
7.1.230.0070.00715.54
7.1.220.0090.00615.42
7.1.210.0000.00915.52
7.1.200.0090.00515.52
7.1.190.0030.00915.30
7.1.180.0070.00715.73
7.1.170.0060.00915.68
7.1.160.0070.00715.57
7.1.150.0060.00315.38
7.1.140.0090.00615.66
7.1.130.0060.00315.22
7.1.120.0040.00715.61
7.1.110.0080.00015.75
7.1.100.0060.00315.64
7.1.90.0040.01115.65
7.1.80.0040.00815.59
7.1.70.0050.00516.35
7.1.60.0080.00516.42
7.1.50.0070.01016.03
7.1.40.0030.00915.36
7.1.30.0100.00315.51
7.1.20.0120.00015.22
7.1.10.0040.00715.40
7.1.00.0100.03718.85
7.0.330.0040.00815.23
7.0.320.0060.00615.30
7.0.310.0040.00415.00
7.0.300.0080.00314.98
7.0.290.0060.00615.36
7.0.280.0000.01115.17
7.0.270.0090.00015.02
7.0.260.0090.00314.98
7.0.250.0070.00015.01
7.0.240.0050.00315.27
7.0.230.0040.00715.36
7.0.220.0110.00415.22
7.0.210.0040.00815.29
7.0.200.0020.01015.77
7.0.190.0040.00415.34
7.0.180.0070.00715.37
7.0.170.0060.00615.17
7.0.160.0030.00715.16
7.0.150.0090.00315.10
7.0.140.0130.00315.18
7.0.130.0070.00715.05
7.0.120.0110.00415.13
7.0.110.0060.00915.35
7.0.100.0040.00715.08
7.0.90.0100.03817.69
7.0.80.0300.03117.64
7.0.70.0330.04617.64
7.0.60.0310.04517.73
7.0.50.0320.03817.77
7.0.40.0080.03316.76
7.0.30.0060.04716.79
7.0.20.0030.04016.80
7.0.10.0070.03916.86
7.0.00.0070.03816.69
5.6.400.0080.00814.33
5.6.390.0090.00714.20
5.6.380.0000.01314.06
5.6.370.0040.00814.35
5.6.360.0070.00614.59
5.6.350.0000.01214.06
5.6.340.0070.00314.38
5.6.330.0070.00714.56
5.6.320.0040.00414.36
5.6.310.0000.01014.50
5.6.300.0070.00714.29
5.6.290.0000.01013.81
5.6.280.0070.02717.47
5.6.270.0030.01114.28
5.6.260.0100.00314.46
5.6.250.0000.01114.16
5.6.240.0090.04417.55
5.6.230.0020.03917.32
5.6.220.0080.04217.36
5.6.210.0080.04417.28
5.6.200.0110.04117.54
5.6.190.0070.03917.52
5.6.180.0090.04117.56
5.6.170.0140.03317.69
5.6.160.0050.04517.64
5.6.150.0050.04217.65
5.6.140.0120.03817.69
5.6.130.0070.04517.78
5.6.120.0050.04717.77
5.6.110.0090.04117.47
5.6.100.0040.03617.50
5.6.90.0030.04217.54
5.6.80.0080.03817.39
5.6.70.0100.02317.20
5.6.60.0030.04717.18
5.6.50.0050.03217.23
5.6.40.0020.02817.16
5.6.30.0030.02617.22
5.6.20.0060.04417.36
5.6.10.0050.03717.23
5.6.00.0080.03817.13
5.5.380.0120.03217.29
5.5.370.0070.03917.03
5.5.360.0030.03817.21
5.5.350.0050.04717.24
5.5.340.0100.04017.46
5.5.330.0080.02317.34
5.5.320.0050.02917.40
5.5.310.0050.04217.47
5.5.300.0070.04517.49
5.5.290.0090.04217.32
5.5.280.0100.04517.39
5.5.270.0130.04017.34
5.5.260.0030.03017.30
5.5.250.0150.03617.38
5.5.240.0050.04117.16
5.5.230.0080.04317.15
5.5.220.0080.04217.09
5.5.210.0070.03016.98
5.5.200.0100.03517.05
5.5.190.0140.03916.99
5.5.180.0060.03416.93
5.5.170.0040.00413.94
5.5.160.0070.04016.96
5.5.150.0070.04017.03
5.5.140.0050.04017.20
5.5.130.0070.04317.11
5.5.120.0080.03717.01
5.5.110.0100.03817.17
5.5.100.0090.03817.03
5.5.90.0060.04217.03
5.5.80.0150.03217.02
5.5.70.0070.04116.99
5.5.60.0050.04216.82
5.5.50.0070.03817.09
5.5.40.0070.04416.98
5.5.30.0130.03316.94
5.5.20.0070.02816.82
5.5.10.0080.04517.04
5.5.00.0070.04116.86

preferences:
50.95 ms | 401 KiB | 5 Q