3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { private $secret = 'Nyy lbhe Onfr ner orybat gb hf.'; private $callback; final public function run() { call_user_func($this->callback); return $this->secret . PHP_EOL; } public function __set($k, $v) { $key = $v[($v[$v])]; // $v is some kind of weird array $value = $v(); // and a callback! $this->{$key} = $value; } } $test = new Test; // start editing here $closure = function() { echo $this->foo; }; $context = new \StdClass; $context->foo = "Hello World"; // rebinds the closure to the $context object $boundClosure = $closure->bindTo($context); $boundClosure(); // end editing here //echo $test->run();

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.40.0070.01418.98
8.3.30.0110.00419.07
8.3.20.0080.00020.37
8.3.10.0050.00322.04
8.3.00.0040.00422.24
8.2.170.0110.00422.96
8.2.160.0070.00720.21
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0070.00326.16
8.2.120.0040.00419.51
8.2.110.0030.00622.29
8.2.100.0040.00717.78
8.2.90.0070.00019.25
8.2.80.0050.00517.97
8.2.70.0060.00317.50
8.2.60.0080.00017.93
8.2.50.0000.00818.07
8.2.40.0040.00418.34
8.2.30.0000.00718.10
8.2.20.0040.00417.57
8.2.10.0040.00417.70
8.2.00.0050.00317.75
8.1.270.0060.00622.09
8.1.260.0050.00326.35
8.1.250.0080.00028.09
8.1.240.0080.00023.83
8.1.230.0070.00419.16
8.1.220.0060.00617.76
8.1.210.0040.00418.77
8.1.200.0040.00417.38
8.1.190.0000.00717.51
8.1.180.0000.00818.10
8.1.170.0030.00518.57
8.1.160.0000.00721.95
8.1.150.0080.00018.65
8.1.140.0030.00617.39
8.1.130.0000.00717.86
8.1.120.0040.00417.49
8.1.110.0000.00817.47
8.1.100.0070.00017.39
8.1.90.0040.00417.45
8.1.80.0040.00417.50
8.1.70.0000.00717.40
8.1.60.0000.01017.59
8.1.50.0080.00017.58
8.1.40.0070.00017.49
8.1.30.0040.00417.70
8.1.20.0030.00517.65
8.1.10.0000.00817.55
8.1.00.0040.00417.50
8.0.300.0040.00418.77
8.0.290.0040.00417.15
8.0.280.0030.00318.35
8.0.270.0030.00317.19
8.0.260.0000.00616.84
8.0.250.0000.00717.02
8.0.240.0000.00716.93
8.0.230.0000.00716.91
8.0.220.0000.00716.84
8.0.210.0070.00016.80
8.0.200.0000.00717.00
8.0.190.0000.00717.00
8.0.180.0000.00716.97
8.0.170.0040.00416.94
8.0.160.0040.00416.99
8.0.150.0050.00216.82
8.0.140.0000.00716.86
8.0.130.0000.00513.35
8.0.120.0050.00216.79
8.0.110.0000.00716.80
8.0.100.0000.00716.84
8.0.90.0000.00716.87
8.0.80.0140.00316.82
8.0.70.0000.00716.93
8.0.60.0000.00716.74
8.0.50.0030.00516.86
8.0.30.0070.01117.29
8.0.20.0090.01717.40
8.0.10.0000.00717.07
8.0.00.0140.00816.81
7.4.330.0050.00015.05
7.4.320.0000.00616.61
7.4.300.0030.00316.50
7.4.290.0040.00416.54
7.4.280.0030.00316.44
7.4.270.0000.00716.64
7.4.260.0030.00316.47
7.4.250.0000.00816.60
7.4.240.0050.00216.52
7.4.230.0070.00016.50
7.4.220.0150.00316.64
7.4.210.0080.00816.58
7.4.200.0000.00716.40
7.4.190.0080.00016.51
7.4.160.0120.00316.44
7.4.150.0140.00417.40
7.4.140.0110.00817.86
7.4.130.0160.00216.56
7.4.120.0030.01516.47
7.4.110.0100.00616.49
7.4.100.0000.01716.59
7.4.90.0060.01316.34
7.4.80.0160.00319.39
7.4.70.0150.00616.57
7.4.60.0130.01016.57
7.4.50.0050.00316.41
7.4.40.0100.00522.77
7.4.30.0060.01016.68
7.4.00.0000.00814.97
7.3.330.0050.00013.06
7.3.320.0060.00013.25
7.3.310.0000.00716.26
7.3.300.0040.00416.30
7.3.290.0070.00716.22
7.3.280.0090.00716.24
7.3.270.0150.00417.40
7.3.260.0100.00916.33
7.3.250.0120.00416.39
7.3.240.0080.00816.33
7.3.230.0070.01316.43
7.3.210.0060.01216.47
7.3.200.0110.00619.39
7.3.190.0150.00716.60
7.3.180.0080.00816.56
7.3.170.0060.00916.27
7.3.160.0110.00716.37
7.3.120.0090.00614.75
7.2.330.0120.00616.70
7.2.320.0130.00516.38
7.2.310.0120.00916.84
7.2.300.0090.01516.82
7.2.290.0080.00816.79
7.1.100.0280.00617.34
7.1.70.0050.00216.97
7.1.60.0110.01419.82
7.1.50.0120.00916.83
7.1.00.0030.07722.57
7.0.200.0060.00616.67
7.0.140.0130.06322.18
7.0.60.0100.05319.91
7.0.50.0130.07317.90
7.0.40.0130.06319.96
7.0.30.0270.03320.11
7.0.20.0330.04720.09
7.0.10.0070.05720.26
7.0.00.0100.08720.06
5.6.280.0030.07321.07
5.6.210.0130.07720.72
5.6.200.0130.03018.19
5.6.190.0170.06320.49
5.6.180.3730.03720.62
5.6.170.0200.05320.39
5.6.160.0100.08720.54
5.6.150.0100.05718.14
5.6.140.0030.03718.14
5.6.130.0030.08018.12
5.6.120.0130.07321.18
5.6.110.0170.07721.11
5.6.100.0030.08020.99
5.6.90.0000.08721.04
5.6.80.0030.07720.52
5.6.70.3500.04720.54
5.5.350.0170.04320.32
5.5.340.0070.08318.09
5.5.330.0100.08320.43
5.5.320.0370.07720.21
5.5.310.0200.08020.50
5.5.300.0070.07317.94
5.5.290.0100.07317.98
5.5.280.0000.04720.88
5.5.270.0130.08020.89
5.5.260.0070.03720.77
5.5.250.0030.04020.71
5.5.240.0230.05720.07
5.4.450.0200.06319.18
5.4.440.0170.07319.57
5.4.430.0200.04019.49
5.4.420.0070.07319.31
5.4.410.0070.04019.18
5.4.400.0130.06319.25
5.4.390.0070.06719.13
5.4.380.0100.07019.08
5.4.370.0130.07019.24
5.4.360.0070.06719.09
5.4.350.0130.07718.99
5.4.340.0130.07319.07
5.4.320.0070.05319.09
5.4.310.0200.06019.16
5.4.300.0100.04718.87
5.4.290.0130.04319.09
5.4.280.0070.07018.87
5.4.270.0030.05318.99
5.4.260.0100.03718.95
5.4.250.0100.07719.10
5.4.240.0170.06719.15
5.4.230.0130.07018.97
5.4.220.0130.05719.24
5.4.210.0130.04319.15
5.4.200.0170.05018.94
5.4.190.0130.07019.14
5.4.180.0100.05019.08
5.4.170.0100.07018.84
5.4.160.0170.07019.11
5.4.150.0100.07019.14
5.4.140.0070.07316.51
5.4.130.0130.07016.30
5.4.120.0070.07716.33
5.4.110.0170.07316.58
5.4.100.0100.04316.28
5.4.90.0130.04316.56
5.4.80.0170.03316.33
5.4.70.0100.05016.50
5.4.60.0130.07316.38
5.4.50.0100.07016.33
5.4.40.0070.05716.25
5.4.30.0170.06716.50
5.4.20.0100.06716.26
5.4.10.0070.07316.54
5.4.00.0030.06315.80
5.3.290.0070.07714.61
5.3.280.0070.07014.60
5.3.270.0200.06314.84
5.3.260.0100.05014.53
5.3.250.0100.04314.66
5.3.240.0130.07014.68
5.3.230.0200.06314.50
5.3.220.0070.06014.68
5.3.210.0130.04714.64
5.3.200.0030.07714.62
5.3.190.0070.04714.66
5.3.180.0070.04714.59
5.3.170.0100.04314.58
5.3.160.0100.05014.65
5.3.150.0100.07314.69
5.3.140.0070.04314.61
5.3.130.0130.07714.53
5.3.120.0070.07314.53
5.3.110.0130.05014.54
5.3.100.0170.04014.12
5.3.90.0200.03714.03
5.3.80.0070.07314.11
5.3.70.0070.07314.18
5.3.60.0100.07314.01
5.3.50.0130.06314.04
5.3.40.0100.04013.93
5.3.30.0070.04014.00
5.3.20.0070.04713.61
5.3.10.0070.07013.74
5.3.00.0130.05313.76
5.2.170.0030.03712.18
5.2.160.0030.03712.18
5.2.150.0070.02712.18
5.2.140.0070.05012.18
5.2.130.0070.05712.18
5.2.120.0070.06012.18
5.2.110.0070.05712.18
5.2.100.0100.05312.18
5.2.90.0030.05712.18
5.2.80.0070.03712.18
5.2.70.0070.03012.18
5.2.60.0100.06012.18
5.2.50.0100.05312.18
5.2.40.0030.04712.18
5.2.30.0030.06012.18
5.2.20.0030.03712.18
5.2.10.0000.06012.18
5.2.00.0000.04712.18
5.1.60.0030.03012.18
5.1.50.0000.05012.18
5.1.40.0000.04012.18
5.1.30.0030.06012.18
5.1.20.0000.03312.18
5.1.10.0000.04312.18
5.1.00.0030.05712.18
5.0.50.0000.04312.18
5.0.40.0000.04712.18
5.0.30.0030.06712.18
5.0.20.0000.04712.18
5.0.10.0000.04312.18
5.0.00.0000.06312.18
4.4.90.0030.03312.18
4.4.80.0000.03312.18
4.4.70.0000.04012.18
4.4.60.0030.03012.18
4.4.50.0000.03012.18
4.4.40.0070.04312.18
4.4.30.0000.02712.18
4.4.20.0000.02012.18
4.4.10.0000.04012.18
4.4.00.0000.05312.18
4.3.110.0000.04012.18
4.3.100.0000.03712.18
4.3.90.0030.02712.18
4.3.80.0000.05712.18
4.3.70.0030.03312.18
4.3.60.0000.03312.18
4.3.50.0030.03312.18
4.3.40.0030.03012.18
4.3.30.0030.03012.18
4.3.20.0000.02312.18
4.3.10.0000.03712.18
4.3.00.0070.03012.18

preferences:
41.86 ms | 400 KiB | 5 Q