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; } } // start class V implements arrayaccess{ public $closure; public function __construct($test){ $this->closure = function(){ echo 'hello'; // a closure to do stuff }; $this->closure->bindTo($test); } // array access stuff I copied any pasted from http://www.php.net/manual/en/class.arrayaccess.php public function offsetSet($offset, $value) { if (is_null($offset)) { $this->array[] = $value; } else { $this->array[$offset] = $value; } } public function offsetExists($offset) { return isset($this->array[$offset]); } public function offsetUnset($offset) { unset($this->array[$offset]); } public function offsetGet($offset) { $offset = (string) $offset; return isset($this->array[$offset]) ? $this->array[$offset] : null; } } $test->callback = new V($test); // 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.0040.01118.56
8.3.50.0110.01121.87
8.3.40.0110.00419.02
8.3.30.0100.00319.09
8.3.20.0070.00020.21
8.3.10.0060.00322.13
8.3.00.0060.00322.46
8.2.180.0090.00916.50
8.2.170.0070.00722.96
8.2.160.0030.01020.39
8.2.150.0080.00024.18
8.2.140.0110.00424.66
8.2.130.0000.01126.16
8.2.120.0030.00619.36
8.2.110.0030.00622.30
8.2.100.0070.00418.03
8.2.90.0080.00017.72
8.2.80.0000.00817.97
8.2.70.0030.00517.80
8.2.60.0000.00817.93
8.2.50.0040.00419.77
8.2.40.0040.00420.59
8.2.30.0030.00918.13
8.2.20.0070.00017.80
8.2.10.0090.00017.75
8.2.00.0050.00217.64
8.1.280.0140.00725.92
8.1.270.0030.00622.06
8.1.260.0040.00426.35
8.1.250.0060.00328.09
8.1.240.0030.00622.05
8.1.230.0070.00420.91
8.1.220.0000.00817.74
8.1.210.0050.00318.77
8.1.200.0000.00917.35
8.1.190.0090.00017.23
8.1.180.0070.00318.10
8.1.170.0000.00818.57
8.1.160.0040.00422.03
8.1.150.0000.00718.73
8.1.140.0040.00417.48
8.1.130.0070.00017.84
8.1.120.0040.00417.55
8.1.110.0030.00317.44
8.1.100.0080.00017.48
8.1.90.0030.00517.49
8.1.80.0070.00017.39
8.1.70.0030.00317.41
8.1.60.0030.01017.61
8.1.50.0000.00817.50
8.1.40.0030.00517.44
8.1.30.0040.00417.58
8.1.20.0030.00517.55
8.1.10.0000.00717.56
8.1.00.0000.00917.52
8.0.300.0070.00019.77
8.0.290.0110.00016.75
8.0.280.0030.00318.48
8.0.270.0070.00017.29
8.0.260.0030.00416.95
8.0.250.0000.00717.02
8.0.240.0000.00817.09
8.0.230.0070.00017.02
8.0.220.0070.00017.00
8.0.210.0000.00716.98
8.0.200.0070.00016.99
8.0.190.0000.00716.92
8.0.180.0030.00516.97
8.0.170.0040.00417.04
8.0.160.0060.00317.02
8.0.150.0070.00016.92
8.0.140.0000.00817.03
8.0.130.0060.00013.39
8.0.120.0050.00316.91
8.0.110.0070.00016.99
8.0.100.0030.00416.82
8.0.90.0000.00717.01
8.0.80.0120.00317.02
8.0.70.0050.00216.94
8.0.60.0000.00816.89
8.0.50.0040.00416.76
8.0.30.0130.00617.11
8.0.20.0080.01217.40
8.0.10.0000.00717.17
8.0.00.0070.01116.73
7.4.330.0030.00315.00
7.4.320.0030.00516.48
7.4.300.0030.00316.49
7.4.290.0030.00316.55
7.4.280.0050.00216.57
7.4.270.0000.00716.49
7.4.260.0030.00616.41
7.4.250.0040.00416.43
7.4.240.0030.00416.55
7.4.230.0000.00716.36
7.4.220.0080.01116.55
7.4.210.0060.00916.50
7.4.200.0070.00016.40
7.4.190.0040.00416.51
7.4.160.0160.00016.43
7.4.150.0180.00617.40
7.4.140.0120.00817.86
7.4.130.0100.01016.47
7.4.120.0140.00616.52
7.4.110.0130.01016.50
7.4.100.0140.00416.57
7.4.90.0060.01216.55
7.4.80.0100.00719.39
7.4.70.0100.01116.46
7.4.60.0100.00716.45
7.4.50.0040.00416.28
7.4.40.0090.00322.77
7.4.30.0110.01116.57
7.4.00.0000.01115.14
7.3.330.0060.00013.24
7.3.320.0000.00613.16
7.3.310.0030.00316.35
7.3.300.0030.00316.25
7.3.290.0060.01216.27
7.3.280.0060.01016.36
7.3.270.0090.00917.40
7.3.260.0200.00316.39
7.3.250.0070.01016.49
7.3.240.0070.01416.63
7.3.230.0120.00916.46
7.3.210.0090.00916.52
7.3.200.0150.00619.39
7.3.190.0030.01316.30
7.3.180.0080.00816.39
7.3.170.0080.00816.47
7.3.160.0080.00816.51
7.3.120.0110.00314.88
7.2.330.0060.01916.65
7.2.320.0160.00916.46
7.2.310.0120.00916.72
7.2.300.0060.01616.76
7.2.290.0100.00716.67
7.2.60.0040.00816.78
7.2.00.0000.01219.13
7.1.200.0040.01115.85
7.1.100.0070.00418.07
7.1.70.0030.00716.84
7.1.60.0110.01419.82
7.1.50.0070.01716.77
7.1.00.0100.07022.35
7.0.200.0030.00316.74
7.0.140.0100.06322.18
7.0.60.0130.07719.93
7.0.50.0070.05317.90
7.0.40.0030.09020.11
7.0.30.0270.05320.23
7.0.20.0300.07720.12
7.0.10.0330.05320.24
7.0.00.0100.08720.16
5.6.280.0070.07021.00
5.6.210.0130.08020.71
5.6.200.0030.04318.29
5.6.190.0000.06320.77
5.6.180.2800.04020.48
5.6.170.0270.07720.44
5.6.160.0130.07720.57
5.6.150.0030.08318.24
5.6.140.0170.07018.15
5.6.130.0100.04018.14
5.6.120.0130.04721.16
5.6.110.0000.05021.02
5.6.100.0130.04720.98
5.6.90.0070.04321.02
5.6.80.0100.07320.38
5.6.70.0400.05720.37
5.5.350.0000.03320.37
5.5.340.0130.07318.09
5.5.330.0100.06720.30
5.5.320.0200.08020.32
5.5.310.0130.05020.34
5.5.300.0030.04317.98
5.5.290.0070.08717.98
5.5.280.0000.05320.79
5.5.270.0100.07320.66
5.5.260.0000.04720.64
5.5.250.0030.04020.71
5.5.240.0030.04020.06
5.4.450.0070.05719.38
5.4.440.0670.06019.12
5.4.430.0130.05319.63
5.4.420.0070.07719.41
5.4.410.0200.04719.32
5.4.400.0900.00018.79
5.4.390.0930.00018.84
5.4.380.0300.04718.74
5.4.370.0230.04318.51
5.4.360.0230.04018.84
5.4.350.0100.05718.84
5.4.340.0130.05318.75
5.4.320.0120.03912.52
5.4.310.0060.04412.52
5.4.300.0030.04012.52
5.4.290.0060.03912.51
5.4.280.0070.04812.41
5.4.270.0170.07018.98
5.4.260.0170.05718.81
5.4.250.0100.07318.79
5.4.240.0070.05718.79
5.4.230.0000.06719.02
5.4.220.0200.06318.94
5.4.210.0170.04318.94
5.4.200.0200.05018.65
5.4.190.0200.05018.93
5.4.180.0070.07019.09
5.4.170.0170.04318.89
5.4.160.0100.07318.74
5.4.150.0130.05319.00
5.4.140.0170.06316.39
5.4.130.0100.06016.58
5.4.120.0100.05716.34
5.4.110.0100.06716.54
5.4.100.0070.05016.41
5.4.90.0070.05316.54
5.4.80.0030.05316.55
5.4.70.0130.06016.55
5.4.60.0030.07316.54
5.4.50.0030.05716.33
5.4.40.0000.06316.35
5.4.30.0100.04716.59
5.4.20.0100.06016.44
5.4.10.0000.07016.46
5.4.00.0170.04715.77
5.3.290.0050.04112.80
5.3.280.0100.06714.52
5.3.270.0070.07314.53
5.3.260.0070.05714.71
5.3.250.0000.06714.69
5.3.240.0230.06714.53
5.3.230.0130.06314.66
5.3.220.0100.05714.77
5.3.210.0070.07014.67
5.3.200.0100.04714.66
5.3.190.0100.07014.69
5.3.180.0070.07014.54
5.3.170.0070.05314.80
5.3.160.0200.06014.48
5.3.150.0030.05714.41
5.3.140.0070.05014.56
5.3.130.0100.05014.70
5.3.120.0130.07314.65
5.3.110.0000.05714.53
5.3.100.0100.05014.13
5.3.90.0030.07314.12
5.3.80.0100.05714.22
5.3.70.0030.05314.20
5.3.60.0170.04314.24
5.3.50.0100.04713.96
5.3.40.0070.06714.13
5.3.30.0130.06013.75
5.3.20.0070.04713.80
5.3.10.0100.06713.57
5.3.00.0030.05313.66
5.2.170.0070.06011.12
5.2.160.0100.04011.31
5.2.150.0130.04011.33
5.2.140.0030.06011.23
5.2.130.0130.03311.18
5.2.120.0070.05711.01
5.2.110.0100.05011.19
5.2.100.0100.04311.06
5.2.90.0100.04711.21
5.2.80.0070.04311.18
5.2.70.0030.04311.10
5.2.60.0130.04311.23
5.2.50.0030.04311.02
5.2.40.0070.05310.91
5.2.30.0100.05710.98
5.2.20.0070.04310.97
5.2.10.0130.04710.87
5.2.00.0070.04310.63
5.1.60.0030.05010.05
5.1.50.0070.03310.09
5.1.40.0100.04710.08
5.1.30.0100.03010.30
5.1.20.0000.04310.54
5.1.10.0030.03710.31
5.1.00.0170.04010.07
5.0.50.0030.0378.55
5.0.40.0000.0338.28
5.0.30.0100.0408.20
5.0.20.0030.0278.25
5.0.10.0070.0408.14
5.0.00.0030.0438.28
4.4.90.0000.0335.82
4.4.80.0000.0335.85
4.4.70.0100.0205.86
4.4.60.0130.0175.89
4.4.50.0070.0235.83
4.4.40.0100.0275.82
4.4.30.0070.0275.96
4.4.20.0100.0275.89
4.4.10.0000.0375.96
4.4.00.0100.0375.89
4.3.110.0030.0305.83
4.3.100.0070.0175.73
4.3.90.0000.0335.73
4.3.80.0030.0405.71
4.3.70.0000.0235.88
4.3.60.0070.0235.75
4.3.50.0100.0235.80
4.3.40.0030.0405.70
4.3.30.0000.0275.46
4.3.20.0070.0175.46
4.3.10.0000.0335.46
4.3.00.0030.0206.54

preferences:
52.52 ms | 401 KiB | 5 Q