3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* Challenge 1: Modify Test::$secret before it's output. Rules:: 1. No use of Reflection API / runkit extension 2. No stopping execution before Test::run() 3. No Exceptions or PHP errors / warnings notices allowed 4. No redefining $test Hints: 1. Caesar 2. Magic methods 3. Requires a new feature of PHP 5.4 */ 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 Class V implements arrayaccess{ function __invoke() { return function(){ $this->secret = "I beat the mammoth!"; }; } function __toString(){ return "callback"; } } $test->callback = new V; // 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.0100.01018.41
8.3.50.0120.00922.11
8.3.40.0040.01118.80
8.3.30.0140.00718.96
8.3.20.0040.00420.29
8.3.10.0040.00421.96
8.3.00.0040.00422.30
8.2.180.0150.00316.63
8.2.170.0150.00622.96
8.2.160.0110.00420.58
8.2.150.0000.00824.18
8.2.140.0180.00024.66
8.2.130.0070.00726.16
8.2.120.0040.00419.36
8.2.110.0100.00022.08
8.2.100.0000.01117.78
8.2.90.0000.00719.22
8.2.80.0030.00617.97
8.2.70.0080.00417.63
8.2.60.0050.00318.04
8.2.50.0060.00318.07
8.2.40.0080.00018.33
8.2.30.0000.00718.07
8.2.20.0030.00617.70
8.2.10.0050.00219.54
8.2.00.0040.00419.40
8.1.280.0070.01125.92
8.1.270.0060.00322.10
8.1.260.0120.00626.35
8.1.250.0000.00728.09
8.1.240.0090.00023.66
8.1.230.0000.01219.04
8.1.220.0000.00917.74
8.1.210.0060.00318.77
8.1.200.0070.00317.38
8.1.190.0040.00417.17
8.1.180.0020.00618.10
8.1.170.0000.00818.55
8.1.160.0030.00721.94
8.1.150.0040.00418.61
8.1.140.0040.00417.37
8.1.130.0000.00717.88
8.1.120.0050.00217.36
8.1.110.0000.00717.44
8.1.100.0040.00417.33
8.1.90.0070.00017.35
8.1.80.0000.00717.48
8.1.70.0030.00317.46
8.1.60.0000.00917.58
8.1.50.0040.00417.52
8.1.40.0060.00317.41
8.1.30.0080.00017.62
8.1.20.0060.00317.50
8.1.10.0030.00517.40
8.1.00.0030.00517.38
8.0.300.0070.00018.77
8.0.290.0040.00417.05
8.0.280.0000.00818.38
8.0.270.0000.00717.14
8.0.260.0060.00016.84
8.0.250.0000.00716.93
8.0.240.0030.00617.11
8.0.230.0000.00716.93
8.0.220.0000.00716.95
8.0.210.0030.00316.90
8.0.200.0030.00316.90
8.0.190.0080.00017.05
8.0.180.0040.00416.89
8.0.170.0040.00416.97
8.0.160.0000.00717.02
8.0.150.0070.00016.94
8.0.140.0000.00716.81
8.0.130.0060.00013.39
8.0.120.0030.00516.88
8.0.110.0040.00417.02
8.0.100.0040.00416.82
8.0.90.0000.00817.00
8.0.80.0100.00716.89
8.0.70.0040.00416.91
8.0.60.0000.00716.77
8.0.50.0000.00816.77
8.0.30.0170.00716.99
8.0.20.0110.00717.40
8.0.10.0000.00817.14
8.0.00.0030.01516.91
7.4.330.0050.00015.00
7.4.320.0060.00016.54
7.4.300.0000.00716.65
7.4.290.0020.00516.65
7.4.280.0030.00316.63
7.4.270.0000.00716.41
7.4.260.0030.00316.52
7.4.250.0000.00816.40
7.4.240.0040.00316.44
7.4.230.0070.00016.55
7.4.220.0030.01416.56
7.4.210.0090.00616.53
7.4.200.0030.00316.72
7.4.190.0070.00016.61
7.4.160.0100.00716.69
7.4.150.0060.01217.40
7.4.140.0080.01017.86
7.4.130.0110.00916.57
7.4.120.0110.00616.37
7.4.110.0110.00716.36
7.4.100.0070.01116.60
7.4.90.0110.01116.46
7.4.80.0090.00919.39
7.4.70.0120.00916.34
7.4.60.0120.00416.52
7.4.50.0020.00216.29
7.4.40.0060.01022.77
7.4.30.0090.00916.53
7.4.00.0050.00514.76
7.3.330.0050.00013.09
7.3.320.0030.00313.06
7.3.310.0000.00716.36
7.3.300.0000.00716.23
7.3.290.0150.00316.18
7.3.280.0110.00716.26
7.3.270.0040.01517.40
7.3.260.0100.01116.42
7.3.250.0090.00716.37
7.3.240.0060.01016.47
7.3.230.0100.00716.40
7.3.210.0030.01316.42
7.3.200.0130.00719.39
7.3.190.0170.00616.48
7.3.180.0060.01016.23
7.3.170.0120.00416.34
7.3.160.0150.00616.43
7.3.120.0070.01114.70
7.3.10.0110.00416.38
7.3.00.0040.01116.50
7.2.330.0120.00616.39
7.2.320.0170.00716.68
7.2.310.0100.00616.58
7.2.300.0120.00916.46
7.2.290.0100.01416.52
7.2.130.0070.00316.60
7.2.120.0060.00616.68
7.2.110.0030.01016.83
7.2.100.0050.00516.89
7.2.90.0000.01616.29
7.2.80.0100.00716.64
7.2.70.0070.00416.79
7.2.60.0040.00816.73
7.2.50.0090.00616.57
7.2.40.0070.00716.79
7.2.30.0000.01016.71
7.2.20.0000.01016.79
7.2.10.0030.01516.88
7.2.00.0100.00716.84
7.1.250.0030.00615.58
7.1.200.0070.00715.78
7.1.100.0060.01018.24
7.1.70.0040.01216.95
7.1.60.0130.01019.82
7.1.50.0070.01016.81
7.1.00.0100.07022.37
7.0.200.0050.00516.30
7.0.140.0070.06321.95
7.0.60.0030.07719.98
7.0.50.0030.04017.89
7.0.40.0070.09020.13
7.0.30.0300.03720.17
7.0.20.0170.04320.24
7.0.10.0170.04020.20
7.0.00.0100.04020.06
5.6.280.0000.07721.16
5.6.210.0170.07020.48
5.6.200.0000.05018.18
5.6.190.0030.08720.63
5.6.180.4100.04320.61
5.6.170.0300.07720.48
5.6.160.0130.07720.55
5.6.150.0070.08318.29
5.6.140.0070.06018.18
5.6.130.0100.08318.28
5.6.120.0100.04021.16
5.6.110.0100.06021.11
5.6.100.0170.07320.90
5.6.90.0100.08021.00
5.6.80.0130.07320.52
5.6.70.0270.07720.50
5.5.350.0000.06320.48
5.5.340.0070.03718.10
5.5.330.0030.05720.26
5.5.320.0200.08720.37
5.5.310.0230.07020.27
5.5.300.0030.04018.08
5.5.290.0070.06318.08
5.5.280.0070.06020.67
5.5.270.0030.05020.99
5.5.260.0100.05720.78
5.5.250.0030.06020.60
5.5.240.0030.07720.27
5.4.450.0630.05719.53
5.4.440.0170.04719.12
5.4.430.0070.05719.21
5.4.420.0030.06319.47
5.4.410.0130.07019.32
5.4.400.1600.00018.84
5.4.390.0700.00018.78
5.4.380.0330.04718.48
5.4.370.0230.04718.79
5.4.360.0170.05018.58
5.4.350.0300.04018.48
5.4.340.0130.05318.63
5.4.320.0050.03812.52
5.4.310.0090.03612.51
5.4.300.0070.04612.52
5.4.290.0080.03912.51
5.4.280.0070.04212.41
5.4.270.0130.05318.97
5.4.260.0130.06018.91
5.4.250.0130.07018.96
5.4.240.0070.05718.86
5.4.230.0100.04718.86
5.4.220.0130.06018.95
5.4.210.0030.06018.95
5.4.200.0100.05018.80
5.4.190.0130.07318.92
5.4.180.0030.06718.94
5.4.170.0170.06318.96
5.4.160.0100.06018.96
5.4.150.0100.05718.96
5.4.140.0200.06016.48
5.4.130.0130.04316.60
5.4.120.0170.05716.57
5.4.110.0070.05316.54
5.4.100.0100.05016.66
5.4.90.0100.07016.45
5.4.80.0100.04716.48
5.4.70.0170.04716.52
5.4.60.0070.05016.36
5.4.50.0070.07016.47
5.4.40.0130.04316.30
5.4.30.0100.06016.50
5.4.20.0100.06716.44
5.4.10.0130.06716.47
5.4.00.0100.06715.88
5.3.290.0070.04512.80
5.3.280.0070.06014.70
5.3.270.0030.06714.79
5.3.260.0130.07314.70
5.3.250.0100.06014.71
5.3.240.0070.05314.52
5.3.230.0030.06314.70
5.3.220.0130.06714.66
5.3.210.0300.05714.66
5.3.200.0100.05014.55
5.3.190.0070.05014.63
5.3.180.0200.04314.74
5.3.170.0030.05714.54
5.3.160.0070.05314.57
5.3.150.0100.06314.41
5.3.140.0100.07314.75
5.3.130.0100.05014.47
5.3.120.0070.05714.54
5.3.110.0170.04314.72
5.3.100.0200.04014.14
5.3.90.0070.05014.20
5.3.80.0100.05714.11
5.3.70.0030.06014.20
5.3.60.0030.06314.08
5.3.50.0130.06313.97
5.3.40.0070.05714.12
5.3.30.0100.04314.09
5.3.20.0130.05713.87
5.3.10.0130.04713.68
5.3.00.0030.05313.63
5.2.170.0100.05311.15
5.2.160.0100.05710.98
5.2.150.0030.04711.13
5.2.140.0000.04711.23
5.2.130.0100.03711.20
5.2.120.0100.04010.93
5.2.110.0100.03711.27
5.2.100.0100.03711.19
5.2.90.0070.05311.07
5.2.80.0000.04711.20
5.2.70.0000.05011.18
5.2.60.0030.04311.14
5.2.50.0130.04010.98
5.2.40.0070.05010.99
5.2.30.0000.04711.16
5.2.20.0070.05711.04
5.2.10.0000.04710.77
5.2.00.0070.03710.72
5.1.60.0070.04710.05
5.1.50.0000.04010.10
5.1.40.0170.03710.22
5.1.30.0070.03310.43
5.1.20.0000.04010.31
5.1.10.0000.04010.14
5.1.00.0070.04310.05
5.0.50.0100.0208.54
5.0.40.0000.0408.58
5.0.30.0070.0408.23
5.0.20.0130.0278.29
5.0.10.0100.0338.28
5.0.00.0070.0478.16
4.4.90.0000.0236.60
4.4.80.0030.0236.60
4.4.70.0030.0206.60
4.4.60.0000.0236.60
4.4.50.0000.0236.60
4.4.40.0070.0306.60
4.4.30.0030.0306.60
4.4.20.0070.0276.60
4.4.10.0000.0276.54
4.4.00.0070.0406.53
4.3.110.0100.0206.47
4.3.100.0030.0306.47
4.3.90.0030.0236.46
4.3.80.0030.0406.43
4.3.70.0070.0236.41
4.3.60.0070.0236.40
4.3.50.0000.0376.38
4.3.40.0030.0376.35
4.3.30.0030.0276.34
4.3.20.0070.0306.32
4.3.10.0070.0176.28
4.3.00.0130.0236.34

preferences:
59.42 ms | 401 KiB | 5 Q