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 $fn = function(){ return $this->secret = 'hello'; }; $arrayAndCallback = array('a', 'b'); $arrayAndCallback = $fn->bindTo($test, 'Test'); // specify class name $test->callback = $arrayAndCallback; // 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.0130.00718.68
8.3.50.0130.00121.99
8.3.40.0040.01118.97
8.3.30.0040.01119.04
8.3.20.0040.00420.21
8.3.10.0040.00422.14
8.3.00.0040.00422.38
8.2.180.0120.00916.75
8.2.170.0070.00722.96
8.2.160.0100.01020.52
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0080.00626.16
8.2.120.0050.00319.48
8.2.110.0000.00922.30
8.2.100.0120.00317.83
8.2.90.0060.00319.34
8.2.80.0000.00918.05
8.2.70.0000.00817.63
8.2.60.0050.00318.03
8.2.50.0060.00318.07
8.2.40.0000.00818.16
8.2.30.0080.00418.15
8.2.20.0050.00317.78
8.2.10.0000.00817.71
8.2.00.0040.00417.82
8.1.280.0110.00425.92
8.1.270.0080.00022.06
8.1.260.0140.00026.35
8.1.250.0020.00528.09
8.1.240.0040.00423.88
8.1.230.0070.00419.16
8.1.220.0000.00917.79
8.1.210.0000.00818.77
8.1.200.0030.00617.38
8.1.190.0040.00417.54
8.1.180.0000.00918.10
8.1.170.0040.00418.59
8.1.160.0000.00721.94
8.1.150.0020.00518.66
8.1.140.0070.00317.37
8.1.130.0070.00017.76
8.1.120.0040.00417.39
8.1.110.0000.00717.46
8.1.100.0040.00417.43
8.1.90.0050.00217.30
8.1.80.0070.00017.48
8.1.70.0030.00317.38
8.1.60.0040.00417.53
8.1.50.0040.00417.54
8.1.40.0020.00517.57
8.1.30.0040.00417.59
8.1.20.0080.00017.65
8.1.10.0050.00217.57
8.1.00.0000.00717.40
8.0.300.0040.00418.77
8.0.290.0040.00416.93
8.0.280.0030.00318.46
8.0.270.0030.00317.21
8.0.260.0030.00316.76
8.0.250.0030.00317.02
8.0.240.0000.00716.86
8.0.230.0070.00016.91
8.0.220.0030.00316.90
8.0.210.0040.00416.88
8.0.200.0060.00317.01
8.0.190.0000.00816.95
8.0.180.0070.00016.89
8.0.170.0040.00417.06
8.0.160.0070.00016.97
8.0.150.0070.00316.89
8.0.140.0040.00416.82
8.0.130.0000.00513.36
8.0.120.0030.00616.82
8.0.110.0040.00416.81
8.0.100.0000.00716.84
8.0.90.0000.00716.94
8.0.80.0080.00816.97
8.0.70.0050.00317.01
8.0.60.0000.00716.80
8.0.50.0050.00216.82
8.0.30.0110.00817.21
8.0.20.0080.01117.40
8.0.10.0040.00417.14
8.0.00.0130.01016.64
7.4.330.0050.00015.00
7.4.320.0000.00616.61
7.4.300.0060.00016.63
7.4.290.0030.00316.54
7.4.280.0040.00416.64
7.4.270.0000.00716.57
7.4.260.0030.00316.37
7.4.250.0040.00416.41
7.4.240.0040.00416.53
7.4.230.0030.00316.73
7.4.220.0170.01016.50
7.4.210.0110.00716.58
7.4.200.0040.00416.62
7.4.190.0050.00216.75
7.4.160.0040.01316.33
7.4.150.0030.01617.40
7.4.140.0100.00817.86
7.4.130.0030.01316.51
7.4.120.0110.01116.61
7.4.110.0090.00916.62
7.4.100.0030.01516.59
7.4.90.0040.01316.51
7.4.80.0100.01319.39
7.4.70.0070.01016.64
7.4.60.0120.00416.57
7.4.50.0080.00016.36
7.4.40.0030.01022.77
7.4.30.0060.01016.60
7.4.00.0030.01314.86
7.3.330.0000.00613.38
7.3.320.0000.00513.19
7.3.310.0040.00416.25
7.3.300.0000.00716.43
7.3.290.0100.00316.40
7.3.280.0070.00916.37
7.3.270.0140.00417.40
7.3.260.0060.01216.56
7.3.250.0100.00816.59
7.3.240.0060.00916.42
7.3.230.0160.00016.60
7.3.210.0100.01016.32
7.3.200.0100.00719.39
7.3.190.0080.01416.31
7.3.180.0140.00416.21
7.3.170.0030.01216.59
7.3.160.0000.01616.51
7.3.120.0090.00914.95
7.2.330.0150.00616.37
7.2.320.0100.01416.69
7.2.310.0120.00416.70
7.2.300.0080.01216.63
7.2.290.0100.00716.67
7.2.80.0130.00316.61
7.2.60.0040.00416.86
7.2.00.0090.00319.14
7.1.200.0060.00615.88
7.1.100.0000.01318.49
7.1.70.0040.00717.07
7.1.60.0170.00719.82
7.1.50.0140.00017.00
7.1.00.0000.08022.46
7.0.200.0140.00016.77
7.0.140.0070.07022.01
7.0.60.0030.06720.03
7.0.50.0070.03717.88
7.0.40.0100.08020.16
7.0.30.0230.08320.24
7.0.20.0270.07020.20
7.0.10.0030.07320.06
7.0.00.0130.04720.08
5.6.280.0000.07720.87
5.6.210.0030.08020.61
5.6.200.0000.08318.14
5.6.190.0170.04720.61
5.6.180.0770.05320.43
5.6.170.0370.07320.55
5.6.160.0100.08020.52
5.6.150.0130.06318.18
5.6.140.0030.07318.16
5.6.130.0030.04718.18
5.6.120.0030.09321.02
5.6.110.0130.07321.02
5.6.100.0100.07321.14
5.6.90.0030.07721.11
5.6.80.0170.05320.41
5.5.350.0030.08320.45
5.5.340.0030.04018.02
5.5.330.0100.07320.36
5.5.320.0000.07720.30
5.5.310.0230.08320.32
5.5.300.0000.04318.08
5.5.290.0030.04717.94
5.5.280.0170.07720.90
5.5.270.0100.05720.78
5.5.260.0070.07720.78
5.5.250.0100.06020.69
5.5.240.0230.07720.36
5.4.450.0200.05019.39
5.4.440.0300.04319.48
5.4.430.0400.06719.41
5.4.420.0400.05719.40
5.4.410.0230.05319.36
5.4.400.0300.03719.07
5.4.390.0300.04019.06
5.4.380.0300.03319.22
5.4.370.0330.03718.95
5.4.360.0230.04719.20
5.4.350.0270.04719.07
5.4.340.0300.05318.98
5.4.320.0400.08018.95
5.4.310.0330.06719.16
5.4.300.0370.06318.97
5.4.290.0300.05019.31
5.4.280.0430.06318.87
5.4.270.0370.06719.14
5.4.260.0330.07019.05
5.4.250.0430.06019.21
5.4.240.0300.04319.05
5.4.230.0230.05019.23
5.4.220.0300.03718.96
5.4.210.0430.03018.86
5.4.200.0300.07319.08
5.4.190.0300.06019.07
5.4.180.0370.03318.84
5.4.170.0270.04318.93
5.4.160.0230.04319.07
5.4.150.0300.04719.07
5.4.140.0370.05016.42
5.4.130.0370.04316.28
5.4.120.0430.03316.36
5.4.110.0300.03316.21
5.4.100.0200.04716.50
5.4.90.0300.03716.27
5.4.80.0300.03716.34
5.4.70.0270.06016.52
5.4.60.0270.04716.33
5.4.50.0370.07016.56
5.4.40.0330.03716.24
5.4.30.0370.06716.25
5.4.20.0330.05016.16
5.4.10.0330.05716.55
5.4.00.0470.07315.80
5.3.290.0370.03314.64
5.3.280.0230.04014.77
5.3.270.0530.05714.59
5.3.260.0370.07014.83
5.3.250.0370.02714.58
5.3.240.0370.03714.77
5.3.230.0370.07014.52
5.3.220.0330.07014.66
5.3.210.0400.05714.59
5.3.200.0270.03714.54
5.3.190.0330.04014.48
5.3.180.0330.07314.56
5.3.170.0330.03714.68
5.3.160.0300.03314.57
5.3.150.0300.03714.59
5.3.140.0270.04314.58
5.3.130.0330.06314.66
5.3.120.0230.05714.66
5.3.110.0300.07314.55
5.3.100.0370.06714.06
5.3.90.0400.04014.11
5.3.80.0400.06313.93
5.3.70.0270.04013.92
5.3.60.0370.07013.94
5.3.50.0230.04014.12
5.3.40.0270.03714.04
5.3.30.0230.03313.84
5.3.20.0270.03713.68
5.3.10.0230.03313.56
5.3.00.0270.04013.89
5.2.170.0300.03011.24
5.2.160.0200.03011.16
5.2.150.0270.03011.08
5.2.140.0170.03011.13
5.2.130.0200.03011.34
5.2.120.0170.02711.01
5.2.110.0170.02711.22
5.2.100.0170.03011.01
5.2.90.0200.02711.13
5.2.80.0200.03011.03
5.2.70.0230.02311.03
5.2.60.0170.03011.06
5.2.50.0170.03011.00
5.2.40.0130.03010.98
5.2.30.0170.02711.14
5.2.20.0130.03010.86
5.2.10.0170.02310.81
5.2.00.0170.03310.65
5.1.60.0200.0209.98
5.1.50.0230.0209.91
5.1.40.0130.0239.95
5.1.30.0130.02710.36
5.1.20.0130.02710.47
5.1.10.0170.0239.96
5.1.00.0200.02710.13
5.0.50.0070.0238.54
5.0.40.0130.0138.35
5.0.30.0030.0338.21
5.0.20.0130.0178.19
5.0.10.0100.0178.11
5.0.00.0130.0308.25
4.4.90.0070.0137.66
4.4.80.0030.0177.66
4.4.70.0100.0137.66
4.4.60.0070.0177.66
4.4.50.0030.0207.66
4.4.40.0070.0237.66
4.4.30.0100.0107.66
4.4.20.0070.0177.66
4.4.10.0070.0177.66
4.4.00.0070.0237.66
4.3.110.0070.0177.66
4.3.100.0100.0107.66
4.3.90.0030.0177.66
4.3.80.0100.0207.66
4.3.70.0070.0137.66
4.3.60.0030.0177.66
4.3.50.0070.0137.66
4.3.40.0070.0237.66
4.3.30.0030.0137.66
4.3.20.0000.0207.66
4.3.10.0000.0177.66
4.3.00.0030.0137.66

preferences:
56.63 ms | 401 KiB | 5 Q