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 Joe implements arrayaccess{ function __invoke() { return function(){ $this->secret = "I beat the mammoth!"; }; } } $test->callback = new Joe; // 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.0110.00318.30
8.3.50.0090.01121.99
8.3.40.0030.01218.90
8.3.30.0100.00718.95
8.3.20.0000.00820.39
8.3.10.0080.00022.13
8.3.00.0040.00422.39
8.2.180.0070.01116.63
8.2.170.0090.00622.96
8.2.160.0100.00720.35
8.2.150.0080.00024.18
8.2.140.0190.00024.66
8.2.130.0030.01226.16
8.2.120.0080.00019.36
8.2.110.0000.00922.18
8.2.100.0060.01217.97
8.2.90.0050.00517.75
8.2.80.0040.00418.04
8.2.70.0050.00317.93
8.2.60.0050.00318.04
8.2.50.0080.00018.10
8.2.40.0040.00420.59
8.2.30.0090.00018.13
8.2.20.0060.00317.61
8.2.10.0000.00819.58
8.2.00.0000.00817.76
8.1.280.0090.00925.92
8.1.270.0060.01322.10
8.1.260.0090.00026.35
8.1.250.0000.00728.09
8.1.240.0060.00323.98
8.1.230.0070.00419.10
8.1.220.0030.00617.74
8.1.210.0040.00418.77
8.1.200.0060.00317.35
8.1.190.0000.00917.10
8.1.180.0090.00018.10
8.1.170.0040.00418.50
8.1.160.0000.01021.93
8.1.150.0000.00818.56
8.1.140.0040.00417.38
8.1.130.0070.00017.82
8.1.120.0030.00317.47
8.1.110.0040.00417.36
8.1.100.0040.00417.34
8.1.90.0040.00417.46
8.1.80.0000.00717.36
8.1.70.0000.00817.39
8.1.60.0040.00417.54
8.1.50.0000.00817.41
8.1.40.0050.00217.50
8.1.30.0040.00417.50
8.1.20.0000.00817.61
8.1.10.0000.00817.50
8.1.00.0020.00517.46
8.0.300.0070.00019.67
8.0.290.0000.00816.75
8.0.280.0030.00318.40
8.0.270.0040.00417.25
8.0.260.0030.00316.93
8.0.250.0060.00316.93
8.0.240.0030.00717.01
8.0.230.0000.00717.05
8.0.220.0040.00416.96
8.0.210.0030.00316.86
8.0.200.0030.00317.02
8.0.190.0080.00016.99
8.0.180.0070.00016.87
8.0.170.0030.00516.91
8.0.160.0040.00417.02
8.0.150.0030.00317.00
8.0.140.0070.00016.82
8.0.130.0000.00713.36
8.0.120.0040.00416.96
8.0.110.0080.00016.89
8.0.100.0000.00716.76
8.0.90.0000.00716.97
8.0.80.0070.01417.02
8.0.70.0050.00216.90
8.0.60.0040.00416.78
8.0.50.0070.00016.87
8.0.30.0130.00616.93
8.0.20.0090.00917.40
8.0.10.0040.00416.92
8.0.00.0090.01216.78
7.4.330.0000.00515.16
7.4.320.0060.00016.59
7.4.300.0030.00316.52
7.4.290.0070.00016.65
7.4.280.0030.00516.59
7.4.270.0030.00316.46
7.4.260.0040.00416.64
7.4.250.0040.00416.62
7.4.240.0040.00316.58
7.4.230.0030.00316.66
7.4.220.0000.02516.56
7.4.210.0110.00516.59
7.4.200.0030.00316.68
7.4.190.0040.00416.49
7.4.160.0070.01116.34
7.4.150.0090.00917.40
7.4.140.0130.00817.86
7.4.130.0030.01516.49
7.4.120.0080.01216.51
7.4.110.0030.01316.45
7.4.100.0120.00616.59
7.4.90.0060.01216.46
7.4.80.0150.00419.39
7.4.70.0080.00816.66
7.4.60.0080.00816.37
7.4.50.0040.00016.71
7.4.40.0030.00722.77
7.4.30.0090.00616.39
7.4.00.0080.00714.83
7.3.330.0050.00013.09
7.3.320.0030.00313.23
7.3.310.0040.00416.10
7.3.300.0000.00716.30
7.3.290.0040.01016.27
7.3.280.0060.01216.21
7.3.270.0070.01017.40
7.3.260.0060.01416.43
7.3.250.0100.00716.29
7.3.240.0100.00716.33
7.3.230.0090.00616.39
7.3.210.0130.00316.38
7.3.200.0100.00719.39
7.3.190.0090.00916.34
7.3.180.0140.00616.56
7.3.170.0130.00316.50
7.3.160.0120.00916.62
7.3.120.0100.00714.83
7.3.110.0070.01114.64
7.3.100.0100.00714.76
7.3.90.0070.01014.77
7.3.80.0110.00314.76
7.3.70.0180.00014.58
7.3.60.0040.00714.48
7.3.50.0040.01214.48
7.3.40.0120.00614.77
7.3.30.0060.00314.83
7.3.20.0080.00816.61
7.3.10.0040.01116.49
7.3.00.0080.00416.63
7.2.330.0130.00716.35
7.2.320.0110.00816.54
7.2.310.0040.01216.64
7.2.300.0100.01316.66
7.2.290.0130.00916.62
7.2.250.0080.00414.91
7.2.240.0040.01414.90
7.2.230.0060.00615.09
7.2.220.0070.01015.18
7.2.210.0060.00914.69
7.2.200.0030.01414.88
7.2.190.0080.00415.09
7.2.180.0000.01715.04
7.2.170.0040.00714.83
7.2.130.0020.01316.60
7.2.120.0070.00616.90
7.2.110.0130.00416.77
7.2.100.0100.00416.73
7.2.90.0070.00516.64
7.2.80.0130.00617.01
7.2.70.0040.00916.71
7.2.60.0070.00816.65
7.2.50.0050.01116.74
7.2.40.0120.00516.50
7.2.30.0060.01016.69
7.2.20.0110.00616.72
7.2.10.0070.00716.66
7.2.00.0060.00917.49
7.1.330.0100.00315.60
7.1.320.0030.01015.55
7.1.310.0060.01015.66
7.1.300.0090.00615.82
7.1.290.0030.01015.79
7.1.280.0030.00715.70
7.1.270.0070.00715.58
7.1.260.0060.00915.54
7.1.250.0080.00315.34
7.1.200.0030.01015.55
7.1.70.0040.00416.86
7.1.60.0030.00717.19
7.1.50.0060.01616.94
7.1.00.0070.07322.36
7.0.200.0030.00716.66
7.0.140.0000.07322.11
7.0.60.0130.07019.80
7.0.50.0030.04017.90
7.0.40.0070.07320.23
7.0.30.0400.07320.23
7.0.20.0170.04720.07
7.0.10.0100.04720.15
7.0.00.0070.04320.16
5.6.280.0030.07320.90
5.6.210.0070.06720.62
5.6.200.0130.08018.18
5.6.190.0000.04720.63
5.6.180.4130.04020.61
5.6.170.0230.07320.45
5.6.160.0100.04720.43
5.6.150.0100.07718.21
5.6.140.0000.04318.18
5.6.130.0000.05718.28
5.6.120.0070.04721.04
5.6.110.0070.08720.97
5.6.100.0170.07320.99
5.6.90.0170.07720.95
5.6.80.0070.06020.52
5.6.70.0300.05320.36
5.5.350.0100.07020.45
5.5.340.0200.06718.09
5.5.330.0130.07720.13
5.5.320.0100.05020.29
5.5.310.0270.07720.34
5.5.300.0000.04017.95
5.5.290.0100.07018.02
5.5.280.0030.08321.00
5.5.270.0030.04320.68
5.5.260.0170.07320.69
5.5.250.0070.08020.60
5.5.240.0100.08020.29
5.4.450.0670.06319.30
5.4.440.0770.05319.38
5.4.430.0100.05719.41
5.4.420.0130.05019.53
5.4.410.0030.06019.27
5.4.400.1600.00018.88
5.4.390.1600.00018.51
5.4.380.0170.06018.84
5.4.370.0200.05318.57
5.4.360.0200.05018.77
5.4.350.0230.05318.71
5.4.340.0230.05718.51
5.4.320.0100.03412.51
5.4.310.0060.04112.50
5.4.300.0080.03812.51
5.4.290.0060.03812.50
5.4.280.0080.04112.41
5.4.270.0070.07319.03
5.4.260.0130.06718.95
5.4.250.0070.07318.77
5.4.240.0100.06319.00
5.4.230.0000.06018.74
5.4.220.0100.06718.75
5.4.210.0070.05718.75
5.4.200.0100.05019.02
5.4.190.0070.07718.80
5.4.180.0100.05018.85
5.4.170.0130.07019.00
5.4.160.0030.06019.01
5.4.150.0070.05718.92
5.4.140.0370.03316.42
5.4.130.0070.08016.48
5.4.120.0100.06316.40
5.4.110.0130.06716.53
5.4.100.0170.06316.39
5.4.90.0130.04016.57
5.4.80.0130.04316.45
5.4.70.0100.07316.46
5.4.60.0030.05716.39
5.4.50.0130.04716.49
5.4.40.0070.05316.65
5.4.30.0100.06316.52
5.4.20.0070.05316.54
5.4.10.0170.06016.48
5.4.00.0100.07016.07
5.3.290.0060.04212.80
5.3.280.0070.06314.83
5.3.270.0070.05714.76
5.3.260.0070.05714.68
5.3.250.0030.08314.68
5.3.240.0100.05014.59
5.3.230.0200.04314.59
5.3.220.0070.07314.48
5.3.210.0100.05014.66
5.3.200.0070.05314.67
5.3.190.0070.05314.60
5.3.180.0130.05014.77
5.3.170.0100.07314.66
5.3.160.0070.07014.40
5.3.150.0100.06014.55
5.3.140.0130.06314.40
5.3.130.0070.05714.70
5.3.120.0030.05714.46
5.3.110.0030.05714.57
5.3.100.0070.05314.05
5.3.90.0100.04714.03
5.3.80.0100.05314.12
5.3.70.0100.05714.03
5.3.60.0030.05714.09
5.3.50.0170.04313.93
5.3.40.0070.05714.03
5.3.30.0200.04014.00
5.3.20.0000.07313.92
5.3.10.0030.05313.66
5.3.00.0100.05013.87
5.2.170.0130.05011.37
5.2.160.0070.05711.33
5.2.150.0000.04711.05
5.2.140.0070.06011.31
5.2.130.0000.04310.93
5.2.120.0070.03711.09
5.2.110.0030.04711.07
5.2.100.0100.03311.08
5.2.90.0130.03311.17
5.2.80.0070.04711.18
5.2.70.0130.05311.09
5.2.60.0000.04711.04
5.2.50.0130.04011.03
5.2.40.0130.05010.96
5.2.30.0030.04311.05
5.2.20.0170.03010.95
5.2.10.0100.04010.96
5.2.00.0030.06010.90
5.1.60.0030.05010.13
5.1.50.0030.03710.01
5.1.40.0170.0379.97
5.1.30.0100.03310.33
5.1.20.0030.05710.52
5.1.10.0100.04310.08
5.1.00.0130.03010.18
5.0.50.0100.0238.54
5.0.40.0030.0408.39
5.0.30.0030.0608.27
5.0.20.0030.0338.05
5.0.10.0100.0238.25
5.0.00.0030.0438.18
4.4.90.0030.0236.59
4.4.80.0000.0336.59
4.4.70.0100.0206.59
4.4.60.0100.0176.59
4.4.50.0000.0336.59
4.4.40.0070.0336.59
4.4.30.0000.0236.59
4.4.20.0070.0276.59
4.4.10.0000.0336.59
4.4.00.0000.0336.59
4.3.110.0000.0336.59
4.3.100.0030.0206.59
4.3.90.0070.0276.59
4.3.80.0030.0306.59
4.3.70.0070.0236.59
4.3.60.0030.0276.59
4.3.50.0070.0276.59
4.3.40.0030.0476.59
4.3.30.0030.0236.59
4.3.20.0000.0336.59
4.3.10.0000.0306.59
4.3.00.0030.0206.15

preferences:
42.76 ms | 401 KiB | 5 Q