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->secret; }; // rebinds the closure to the $context object $boundClosure = $closure->bindTo($test); $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.60.0120.00918.43
8.3.50.0210.01021.93
8.3.40.0090.00618.75
8.3.30.0100.00619.25
8.3.20.0040.00420.21
8.3.10.0050.00321.99
8.3.00.0080.00022.45
8.2.180.0070.01418.41
8.2.170.0110.00322.96
8.2.160.0070.00720.52
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0000.00726.16
8.2.120.0050.00317.75
8.2.110.0060.00320.47
8.2.100.0090.00319.63
8.2.90.0090.00019.19
8.2.80.0000.00818.04
8.2.70.0040.00417.63
8.2.60.0040.00417.91
8.2.50.0050.00318.07
8.2.40.0080.00018.22
8.2.30.0070.00318.14
8.2.20.0040.00417.73
8.2.10.0070.00017.87
8.2.00.0000.00717.69
8.1.280.0110.00425.92
8.1.270.0030.00622.18
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0060.00323.69
8.1.230.0030.00719.19
8.1.220.0000.00817.74
8.1.210.0030.00618.77
8.1.200.0030.00617.48
8.1.190.0050.00317.65
8.1.180.0000.00818.10
8.1.170.0000.00818.66
8.1.160.0000.00822.02
8.1.150.0070.00018.69
8.1.140.0080.00017.41
8.1.130.0070.00017.77
8.1.120.0000.00717.45
8.1.110.0040.00417.45
8.1.100.0040.00417.48
8.1.90.0000.00717.50
8.1.80.0040.00417.54
8.1.70.0030.00317.46
8.1.60.0090.00017.59
8.1.50.0000.00717.57
8.1.40.0040.00417.44
8.1.30.0030.00617.52
8.1.20.0000.00817.68
8.1.10.0000.00817.48
8.1.00.0040.00417.52
8.0.300.0040.00418.77
8.0.290.0040.00417.02
8.0.280.0030.00318.41
8.0.270.0030.00317.15
8.0.260.0000.00616.89
8.0.250.0030.00316.98
8.0.240.0070.00017.00
8.0.230.0040.00216.98
8.0.220.0030.00316.82
8.0.210.0040.00416.96
8.0.200.0030.00316.99
8.0.190.0040.00417.02
8.0.180.0040.00417.04
8.0.170.0040.00416.86
8.0.160.0050.00316.97
8.0.150.0040.00416.90
8.0.140.0030.00416.96
8.0.130.0030.00313.39
8.0.120.0040.00416.87
8.0.110.0040.00416.99
8.0.100.0040.00416.79
8.0.90.0040.00417.01
8.0.80.0110.00416.93
8.0.70.0020.00516.85
8.0.60.0000.00716.96
8.0.50.0080.00017.01
8.0.30.0120.00617.13
8.0.20.0090.01317.40
8.0.10.0000.00717.07
8.0.00.0090.01316.88
7.4.330.0000.00515.00
7.4.320.0000.00616.64
7.4.300.0060.00016.60
7.4.290.0000.00716.54
7.4.280.0080.00016.52
7.4.270.0030.00316.63
7.4.260.0070.00016.68
7.4.250.0040.00416.38
7.4.240.0020.00516.55
7.4.230.0040.00316.36
7.4.220.0060.01116.64
7.4.210.0050.01016.62
7.4.200.0000.00716.63
7.4.190.0030.00316.43
7.4.160.0080.00816.41
7.4.150.0120.00617.40
7.4.140.0150.00717.86
7.4.130.0100.00716.58
7.4.120.0100.00816.76
7.4.110.0100.00616.71
7.4.100.0090.01216.64
7.4.90.0100.00716.37
7.4.80.0190.00019.39
7.4.70.0140.00316.48
7.4.60.0080.01216.49
7.4.50.0040.00416.71
7.4.40.0060.01122.77
7.4.30.0130.00616.59
7.4.00.0100.00715.03
7.3.330.0030.00313.24
7.3.320.0020.00213.38
7.3.310.0070.00016.37
7.3.300.0070.00016.27
7.3.290.0100.01016.27
7.3.280.0100.00816.29
7.3.270.0070.01117.40
7.3.260.0100.00816.51
7.3.250.0140.00716.36
7.3.240.0140.00616.37
7.3.230.0130.00616.40
7.3.210.0090.00916.37
7.3.200.0160.00719.39
7.3.190.0120.00916.46
7.3.180.0030.01316.48
7.3.170.0060.01016.44
7.3.160.0100.00716.42
7.3.120.0030.01414.80
7.2.330.0000.01516.40
7.2.320.0210.00316.50
7.2.310.0100.01316.38
7.2.300.0000.01716.71
7.2.290.0080.00816.53
7.2.60.0060.00616.89
7.2.00.0060.00618.83
7.1.200.0040.01115.54
7.1.70.0070.00317.29
7.1.60.0040.00717.25
7.1.50.0100.02134.83
7.1.00.0030.07722.42
7.0.200.0040.00816.75
7.0.140.0100.06322.00
7.0.60.0230.06719.88
7.0.50.0070.04017.88
7.0.40.0070.04020.30
7.0.30.0100.04720.13
7.0.20.0370.07320.24
7.0.10.0070.06320.24
7.0.00.0130.07320.27
5.6.280.0030.07320.83
5.6.210.0100.07020.71
5.6.200.0100.08318.25
5.6.190.0070.08020.64
5.6.180.0300.06320.55
5.6.170.0300.06720.44
5.6.160.0030.08320.57
5.6.150.0130.07718.14
5.6.140.0100.07718.18
5.6.130.0130.07718.15
5.6.120.0070.04321.10
5.6.110.0100.06021.14
5.6.100.0100.03321.09
5.6.90.0070.03721.13
5.6.80.0070.07720.29
5.5.350.4200.04020.39
5.5.340.0030.05017.98
5.5.330.0130.07720.45
5.5.320.2300.05020.20
5.5.310.0100.04320.36
5.5.300.0030.09017.99
5.5.290.0130.06717.94
5.5.280.0130.07720.78
5.5.270.0100.08020.78
5.5.260.0270.06320.89
5.5.250.0030.07320.69
5.5.240.0030.07720.12
5.4.450.0600.05019.48
5.4.440.0500.07019.43
5.4.430.0370.06719.59
5.4.420.0900.04719.27
5.4.410.1100.05719.51
5.4.400.0600.04719.16
5.4.390.0130.05019.16
5.4.380.0200.05318.61
5.4.370.0330.04318.70
5.4.360.0230.05018.59
5.4.350.0270.04718.57
5.4.340.0130.05718.54
5.4.320.0060.03612.51
5.4.310.0080.04712.50
5.4.300.0060.03812.51
5.4.290.0080.04612.50
5.4.280.0100.04812.40
5.4.270.0070.06319.02
5.4.260.0070.05018.94
5.4.250.0130.06718.95
5.4.240.0100.06718.63
5.4.230.0030.05719.02
5.4.220.0170.04718.65
5.4.210.0170.05718.74
5.4.200.0030.06019.02
5.4.190.0130.05718.97
5.4.180.0100.05318.79
5.4.170.0030.06018.74
5.4.160.0130.06318.97
5.4.150.0300.06318.99
5.4.140.0270.05716.41
5.4.130.0200.04316.37
5.4.120.0070.05016.55
5.4.110.0070.07316.51
5.4.100.0030.06016.36
5.4.90.0130.05716.49
5.4.80.0230.05316.54
5.4.70.0100.04716.31
5.4.60.0070.05716.50
5.4.50.0230.05316.33
5.4.40.0100.06316.41
5.4.30.0130.05016.38
5.4.20.0130.04316.54
5.4.10.0170.05716.30
5.4.00.0070.06015.81
5.3.290.0060.04012.80
5.3.280.0100.05014.78
5.3.270.0070.05714.70
5.3.260.0070.05714.60
5.3.250.0130.05314.68
5.3.240.0030.05314.70
5.3.230.0030.07314.70
5.3.220.0130.07014.56
5.3.210.0030.05714.66
5.3.200.0070.05314.40
5.3.190.0030.06014.59
5.3.180.0070.05314.79
5.3.170.0130.05714.59
5.3.160.0200.04314.67
5.3.150.0170.06314.75
5.3.140.0230.04714.55
5.3.130.0130.05014.71
5.3.120.0100.05014.72
5.3.110.0100.05014.54
5.3.100.0230.03714.00
5.3.90.0030.07314.11
5.3.80.0130.06014.19
5.3.70.0070.07014.11
5.3.60.0030.05314.02
5.3.50.0170.05714.04
5.3.40.0070.07014.04
5.3.30.0170.05713.93
5.3.20.0100.04713.71
5.3.10.0130.05713.88
5.3.00.0130.05013.73
5.2.170.0000.04711.23
5.2.160.0100.04011.37
5.2.150.0100.04311.12
5.2.140.0100.04311.23
5.2.130.0070.04311.19
5.2.120.0070.05311.19
5.2.110.0070.03711.09
5.2.100.0030.04711.00
5.2.90.0070.05311.18
5.2.80.0070.05711.18
5.2.70.0070.04011.09
5.2.60.0170.04011.13
5.2.50.0130.04011.01
5.2.40.0070.04011.08
5.2.30.0070.04311.06
5.2.20.0100.05011.13
5.2.10.0130.04010.77
5.2.00.0070.04710.70
5.1.60.0000.0409.98
5.1.50.0000.04310.07
5.1.40.0070.0479.93
5.1.30.0030.04010.34
5.1.20.0030.03710.28
5.1.10.0030.03710.14
5.1.00.0030.04010.23
5.0.50.0030.0308.64
5.0.40.0030.0408.61
5.0.30.0030.0438.23
5.0.20.0100.0308.04
5.0.10.0100.0278.16
5.0.00.0030.0538.14
4.4.90.0070.0276.73
4.4.80.0070.0236.73
4.4.70.0070.0206.73
4.4.60.0100.0176.73
4.4.50.0000.0276.73
4.4.40.0130.0406.73
4.4.30.0030.0236.73
4.4.20.0030.0206.73
4.4.10.0030.0306.73
4.4.00.0130.0406.73
4.3.110.0000.0276.73
4.3.100.0030.0306.73
4.3.90.0030.0206.73
4.3.80.0000.0336.73
4.3.70.0100.0236.73
4.3.60.0000.0336.73
4.3.50.0030.0236.73
4.3.40.0000.0336.73
4.3.30.0070.0276.73
4.3.20.0030.0236.73
4.3.10.0000.0236.73
4.3.00.0070.0238.13

preferences:
49.78 ms | 401 KiB | 5 Q