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){ $closure = function(){ echo 'hello'; // a closure to do stuff }; $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.0000.01518.43
8.3.50.0150.00521.92
8.3.40.0090.00618.93
8.3.30.0070.00719.27
8.3.20.0040.00420.29
8.3.10.0050.00322.09
8.3.00.0060.00322.34
8.2.180.0080.01117.00
8.2.170.0140.00022.96
8.2.160.0100.00720.32
8.2.150.0030.00524.18
8.2.140.0040.00424.66
8.2.130.0070.00326.16
8.2.120.0080.00019.36
8.2.110.0000.00922.25
8.2.100.0120.00017.84
8.2.90.0040.00417.75
8.2.80.0040.00417.97
8.2.70.0000.00817.80
8.2.60.0000.00818.04
8.2.50.0040.00419.76
8.2.40.0000.00820.19
8.2.30.0090.00018.14
8.2.20.0060.00317.75
8.2.10.0050.00217.65
8.2.00.0070.00017.82
8.1.280.0100.00725.92
8.1.270.0040.00421.95
8.1.260.0030.00526.35
8.1.250.0040.00428.09
8.1.240.0070.00422.14
8.1.230.0080.00319.09
8.1.220.0040.00417.74
8.1.210.0000.00820.71
8.1.200.0060.00317.35
8.1.190.0050.00317.23
8.1.180.0030.00718.10
8.1.170.0080.00018.48
8.1.160.0000.00822.03
8.1.150.0060.00318.52
8.1.140.0040.00417.48
8.1.130.0040.00417.85
8.1.120.0000.00817.45
8.1.110.0000.00717.40
8.1.100.0040.00317.38
8.1.90.0000.00817.41
8.1.80.0040.00417.45
8.1.70.0070.00017.41
8.1.60.0050.00517.63
8.1.50.0080.00017.41
8.1.40.0040.00417.52
8.1.30.0030.00517.68
8.1.20.0090.00017.52
8.1.10.0040.00417.58
8.1.00.0030.00717.52
8.0.300.0000.00820.14
8.0.290.0040.00416.63
8.0.280.0030.00318.48
8.0.270.0030.00317.22
8.0.260.0070.00016.90
8.0.250.0070.00016.93
8.0.240.0060.00316.91
8.0.230.0070.00016.94
8.0.220.0070.00017.03
8.0.210.0000.00716.98
8.0.200.0000.00817.05
8.0.190.0070.00017.02
8.0.180.0050.00316.90
8.0.170.0000.00717.04
8.0.160.0040.00417.01
8.0.150.0070.00016.88
8.0.140.0040.00416.94
8.0.130.0030.00313.44
8.0.120.0000.00816.85
8.0.110.0030.00516.99
8.0.100.0070.00016.85
8.0.90.0000.00717.05
8.0.80.0100.01017.03
8.0.70.0000.00716.93
8.0.60.0080.00016.79
8.0.50.0080.00016.95
8.0.30.0090.01017.05
8.0.20.0130.00517.40
8.0.10.0040.00417.17
8.0.00.0070.01516.95
7.4.330.0050.00215.00
7.4.320.0000.00616.54
7.4.300.0040.00416.61
7.4.290.0000.00716.63
7.4.280.0040.00416.41
7.4.270.0030.00316.55
7.4.260.0000.00716.66
7.4.250.0000.00716.51
7.4.240.0020.00616.59
7.4.230.0050.00216.48
7.4.220.0030.01416.48
7.4.210.0080.00816.56
7.4.200.0030.00316.73
7.4.190.0050.00216.50
7.4.160.0060.00916.45
7.4.150.0190.00617.40
7.4.140.0110.01217.86
7.4.130.0130.00516.57
7.4.120.0060.01216.63
7.4.110.0100.00716.34
7.4.100.0180.00016.55
7.4.90.0140.00316.54
7.4.80.0180.00019.39
7.4.70.0000.01516.59
7.4.60.0130.00316.31
7.4.50.0040.00416.61
7.4.40.0100.00622.77
7.4.30.0040.01216.52
7.4.10.0100.00714.84
7.4.00.0070.00815.01
7.3.330.0000.00513.16
7.3.320.0030.00313.36
7.3.310.0030.00316.41
7.3.300.0060.00016.33
7.3.290.0050.01016.30
7.3.280.0080.00716.35
7.3.270.0060.01217.40
7.3.260.0080.01416.38
7.3.250.0090.00816.46
7.3.240.0120.00616.63
7.3.230.0030.01616.58
7.3.210.0130.00516.57
7.3.200.0090.00819.39
7.3.190.0030.01916.57
7.3.180.0080.00816.60
7.3.170.0110.01016.62
7.3.160.0070.01016.35
7.3.130.0040.01414.95
7.3.120.0120.00314.71
7.3.110.0090.00514.83
7.3.100.0100.00514.68
7.3.90.0110.00614.61
7.3.80.0090.00514.92
7.3.70.0050.01114.83
7.3.60.0100.00314.73
7.3.50.0050.01214.96
7.3.40.0050.00814.75
7.3.30.0050.00914.63
7.3.20.0040.00916.48
7.3.10.0050.00816.64
7.3.00.0060.00616.52
7.2.330.0070.01416.29
7.2.320.0090.00916.46
7.2.310.0130.00916.74
7.2.300.0150.00616.82
7.2.290.0060.01016.52
7.2.260.0000.01314.95
7.2.250.0110.00714.95
7.2.240.0080.00414.93
7.2.230.0140.00314.99
7.2.220.0050.01114.83
7.2.210.0060.00715.04
7.2.200.0060.00515.09
7.2.190.0060.01014.78
7.2.180.0070.00715.04
7.2.170.0060.01014.99
7.2.160.0080.00514.95
7.2.150.0080.00516.73
7.2.140.0040.01116.88
7.2.130.0050.00816.68
7.2.120.0040.00816.90
7.2.110.0070.00616.79
7.2.100.0080.00716.67
7.2.90.0040.01016.77
7.2.80.0080.00516.77
7.2.70.0050.00916.73
7.2.60.0070.00916.79
7.2.50.0080.00616.83
7.2.40.0050.00816.84
7.2.30.0080.00616.69
7.2.20.0060.00916.75
7.2.10.0070.00716.76
7.2.00.0090.00716.76
7.1.330.0050.01015.94
7.1.320.0060.00815.77
7.1.310.0050.00915.78
7.1.300.0070.00515.58
7.1.290.0070.01115.78
7.1.280.0070.00915.62
7.1.270.0040.01115.80
7.1.260.0060.00815.72
7.1.250.0050.00615.77
7.1.240.0000.01215.84
7.1.230.0060.01015.76
7.1.220.0030.00915.70
7.1.210.0030.00815.85
7.1.200.0060.00715.81
7.1.190.0050.01115.69
7.1.180.0050.00915.72
7.1.170.0070.00615.68
7.1.160.0060.00615.68
7.1.150.0030.01215.70
7.1.140.0070.00915.73
7.1.130.0040.00915.55
7.1.120.0010.01015.79
7.1.110.0070.00615.74
7.1.100.0070.00615.76
7.1.90.0050.00815.71
7.1.80.0070.00715.74
7.1.70.0040.00816.18
7.1.60.0060.01117.23
7.1.50.0110.00916.25
7.1.40.0080.00515.83
7.1.30.0040.00915.84
7.1.20.0020.01015.69
7.1.10.0080.00515.59
7.1.00.0040.03217.89
7.0.330.0070.00315.36
7.0.320.0050.00515.35
7.0.310.0020.00915.32
7.0.300.0050.00515.39
7.0.290.0050.00515.29
7.0.280.0060.00815.38
7.0.270.0090.00415.25
7.0.260.0070.00515.44
7.0.250.0050.00715.46
7.0.240.0060.00815.32
7.0.230.0040.00815.34
7.0.220.0080.00315.27
7.0.210.0060.00515.46
7.0.200.0040.00715.74
7.0.190.0080.00715.34
7.0.180.0050.00715.46
7.0.170.0000.01015.29
7.0.160.0120.00115.53
7.0.150.0080.00315.48
7.0.140.0060.02717.60
7.0.130.0010.01015.25
7.0.120.0050.01015.46
7.0.110.0080.00815.33
7.0.100.0050.00815.40
7.0.90.0060.00615.37
7.0.80.0090.00315.41
7.0.70.0060.00615.40
7.0.60.0160.02716.94
7.0.50.0040.01916.25
7.0.40.0090.02715.62
7.0.30.0180.02715.69
7.0.20.0080.02415.59
7.0.10.0130.03015.64
7.0.00.0060.02415.63
5.6.400.0090.00314.50
5.6.390.0080.00314.21
5.6.380.0080.00614.45
5.6.370.0080.00514.68
5.6.360.0040.00814.07
5.6.350.0100.00314.33
5.6.340.0060.00614.33
5.6.330.0040.00714.64
5.6.320.0080.00314.54
5.6.310.0080.00614.64
5.6.300.0070.00614.32
5.6.290.0050.00614.19
5.6.280.0040.03116.72
5.6.270.0030.01014.49
5.6.260.0070.00714.43
5.6.250.0080.00314.34
5.6.240.0050.00814.31
5.6.230.0020.00714.37
5.6.220.0060.00914.44
5.6.210.0060.02916.49
5.6.200.0060.02915.67
5.6.190.0070.01816.47
5.6.180.1140.01916.38
5.6.170.0150.01416.50
5.6.160.0070.02716.50
5.6.150.0070.02815.65
5.6.140.0060.03215.64
5.6.130.0060.02715.59
5.6.120.0040.03316.61
5.6.110.0030.03616.54
5.6.100.0050.02116.54
5.6.90.0050.02416.49
5.6.80.0050.03016.30
5.6.70.0020.01114.27
5.6.60.0080.00514.38
5.6.50.0030.01214.37
5.6.40.0060.00414.21
5.6.30.0050.00614.31
5.6.20.0050.00814.17
5.6.10.0050.00914.45
5.6.00.0100.00314.35
5.5.380.0020.00912.82
5.5.370.0050.00712.89
5.5.360.0050.00912.85
5.5.350.0090.03215.15
5.5.340.0090.02914.46
5.5.330.0070.02615.28
5.5.320.0130.02815.31
5.5.310.0110.02015.36
5.5.300.0030.03514.45
5.5.290.0090.02914.50
5.5.280.0060.02415.63
5.5.270.0070.02815.38
5.5.260.0050.02315.42
5.5.250.0030.02915.34
5.5.240.0100.03115.16
5.5.230.0030.00712.68
5.5.220.0060.00612.48
5.5.210.0080.00512.60
5.5.200.0050.00612.68
5.5.190.0090.00312.57
5.5.180.0090.00512.83
5.5.170.0040.00914.05
5.5.160.0070.00312.67
5.5.150.0050.00812.70
5.5.140.0060.00612.70
5.5.130.0050.00812.79
5.5.120.0050.00812.70
5.5.110.0050.00612.80
5.5.100.0050.00512.75
5.5.90.0070.00612.75
5.5.80.0000.00812.86
5.5.70.0020.00812.81
5.5.60.0050.00812.64
5.5.50.0060.00712.49
5.5.40.0060.00712.84
5.5.30.0070.00312.71
5.5.20.0020.00912.84
5.5.10.0060.00512.60
5.5.00.0060.00712.83
5.4.450.0260.02314.20
5.4.440.0200.02114.30
5.4.430.0100.01914.17
5.4.420.0070.02314.25
5.4.410.0060.02214.23
5.4.400.0300.00313.89
5.4.390.0330.00613.88
5.4.380.0110.02314.00
5.4.370.0060.02113.98
5.4.360.0060.02314.00
5.4.350.0070.02214.01
5.4.340.0040.02413.86
5.4.330.0040.00511.71
5.4.320.0050.01711.94
5.4.310.0030.01711.94
5.4.300.0040.01911.98
5.4.290.0070.01711.98
5.4.280.0070.01711.91
5.4.270.0110.02213.85
5.4.260.0080.02614.17
5.4.250.0090.02514.01
5.4.240.0060.03014.06
5.4.230.0060.03013.97
5.4.220.0090.02314.17
5.4.210.0110.02214.11
5.4.200.0060.02613.99
5.4.190.0030.03014.06
5.4.180.0080.02013.93
5.4.170.0110.02513.98
5.4.160.0040.02513.87
5.4.150.0080.02713.93
5.4.140.0050.02613.34
5.4.130.0080.02113.29
5.4.120.0080.01913.16
5.4.110.0070.02413.23
5.4.100.0050.02813.24
5.4.90.0060.02313.28
5.4.80.0080.02413.36
5.4.70.0070.02113.34
5.4.60.0020.02413.25
5.4.50.0110.02913.18
5.4.40.0050.02813.28
5.4.30.0080.02413.30
5.4.20.0060.02213.25
5.4.10.0130.02113.36
5.4.00.0060.02013.03
5.3.290.0060.01811.88
5.3.280.0040.02312.54
5.3.270.0040.02912.53
5.3.260.0040.02312.43
5.3.250.0050.02412.56
5.3.240.0050.02912.48
5.3.230.0070.02512.49
5.3.220.0060.02512.47
5.3.210.0030.02612.50
5.3.200.0090.02112.50
5.3.190.0070.02012.50
5.3.180.0060.02612.53
5.3.170.0040.03012.54
5.3.160.0050.02112.48
5.3.150.0050.01812.52
5.3.140.0080.02212.54
5.3.130.0090.02212.46
5.3.120.0060.03012.49
5.3.110.0070.02212.50
5.3.100.0060.02312.32
5.3.90.0080.02312.29
5.3.80.0060.02912.35
5.3.70.0040.02412.29
5.3.60.0060.02012.31
5.3.50.0030.02312.30
5.3.40.0010.02512.26
5.3.30.0080.02012.31
5.3.20.0040.02212.24
5.3.10.0060.02012.17
5.3.00.0040.02512.16
5.2.170.0030.03010.83
5.2.160.0040.04010.97
5.2.150.0050.03310.99
5.2.140.0030.03310.96
5.2.130.0040.03010.85
5.2.120.0070.02010.89
5.2.110.0090.02710.94
5.2.100.0080.02610.90
5.2.90.0060.02810.77
5.2.80.0090.02510.90
5.2.70.0030.03110.94
5.2.60.0050.02710.87
5.2.50.0100.02010.81
5.2.40.0050.02110.81
5.2.30.0100.02710.84
5.2.20.0080.02310.78
5.2.10.0030.02310.73
5.2.00.0070.02210.76
5.1.60.0100.02310.41
5.1.50.0080.02110.35
5.1.40.0050.02110.40
5.1.30.0050.02510.51
5.1.20.0070.02110.60
5.1.10.0030.02710.31
5.1.00.0050.02210.33
5.0.50.0000.0299.55
5.0.40.0020.0239.62
5.0.30.0070.0239.38
5.0.20.0030.0219.39
5.0.10.0050.0229.41
5.0.00.0020.0289.42
4.4.90.0030.0168.24
4.4.80.0030.0128.29
4.4.70.0020.0188.23
4.4.60.0000.0178.24
4.4.50.0020.0168.23
4.4.40.0050.0238.25
4.4.30.0030.0158.25
4.4.20.0070.0138.32
4.4.10.0030.0178.25
4.4.00.0130.0208.23
4.3.110.0030.0168.19
4.3.100.0050.0128.18
4.3.90.0000.0208.17
4.3.80.0000.0248.18
4.3.70.0000.0148.18
4.3.60.0080.0108.19
4.3.50.0050.0158.14
4.3.40.0020.0258.17
4.3.30.0050.0108.04
4.3.20.0050.0138.04
4.3.10.0080.0128.04
4.3.00.0050.0148.57

preferences:
47.21 ms | 401 KiB | 5 Q