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 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; } } class TestM extends Test { private $secret; public function foo(Test &$obj){ echo $obj->secret;die; $obj->secret = "HELLO WORLD"; } } $test = new Test; // start editing here $testM = new TestM; $testM->foo($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.70.0150.00318.56
8.3.60.0090.00918.48
8.3.50.0220.01221.27
8.3.40.0110.00418.92
8.3.30.0070.00720.34
8.3.20.0040.00420.34
8.3.10.0040.00421.87
8.3.00.0000.00722.18
8.2.190.0100.01016.60
8.2.180.0130.00916.48
8.2.170.0140.00722.96
8.2.160.0070.01120.35
8.2.150.0050.00324.18
8.2.140.0090.00024.66
8.2.130.0110.00726.16
8.2.120.0040.00419.53
8.2.110.0030.00619.35
8.2.100.0040.00817.63
8.2.90.0000.00819.22
8.2.80.0050.00517.97
8.2.70.0040.00817.50
8.2.60.0000.01117.55
8.2.50.0090.00018.07
8.2.40.0060.00317.84
8.2.30.0040.00417.92
8.2.20.0040.00417.55
8.2.10.0000.00717.57
8.2.00.0070.00017.67
8.1.280.0070.00725.92
8.1.270.0070.00024.66
8.1.260.0000.00726.35
8.1.250.0040.00428.09
8.1.240.0030.00624.05
8.1.230.0040.00817.42
8.1.220.0080.00017.74
8.1.210.0040.00418.77
8.1.200.0030.00617.48
8.1.190.0000.00817.23
8.1.180.0080.00018.10
8.1.170.0000.00820.21
8.1.160.0000.00721.92
8.1.150.0050.00318.63
8.1.140.0040.00417.46
8.1.130.0080.00017.83
8.1.120.0020.00517.41
8.1.110.0030.00517.32
8.1.100.0000.00717.39
8.1.90.0030.00517.42
8.1.80.0000.00817.31
8.1.70.0050.00317.34
8.1.60.0040.00417.59
8.1.50.0070.00017.38
8.1.40.0050.00317.53
8.1.30.0030.00617.63
8.1.20.0060.00317.65
8.1.10.0000.00717.53
8.1.00.0060.00317.50
8.0.300.0060.00318.77
8.0.290.0050.00216.63
8.0.280.0070.00018.33
8.0.270.0030.00317.25
8.0.260.0000.00616.82
8.0.250.0030.00316.96
8.0.240.0000.00817.01
8.0.230.0030.00516.93
8.0.220.0040.00416.93
8.0.210.0000.00716.77
8.0.200.0060.00016.95
8.0.190.0000.00716.84
8.0.180.0060.00316.82
8.0.170.0000.00816.85
8.0.160.0000.00716.79
8.0.150.0070.00016.93
8.0.140.0050.00316.93
8.0.130.0000.00613.37
8.0.120.0080.00016.85
8.0.110.0080.00016.86
8.0.100.0040.00416.96
8.0.90.0000.00716.76
8.0.80.0060.00916.94
8.0.70.0040.00416.75
8.0.60.0040.00416.80
8.0.50.0050.00216.79
8.0.30.0110.00816.94
8.0.20.0090.01217.40
8.0.10.0030.00517.04
8.0.00.0100.00916.81
7.4.330.0020.00215.00
7.4.320.0060.00016.50
7.4.300.0020.00516.61
7.4.290.0070.00016.54
7.4.280.0070.00016.50
7.4.270.0000.00716.43
7.4.260.0070.00016.51
7.4.250.0040.00416.57
7.4.240.0020.00516.56
7.4.230.0070.00016.49
7.4.220.0100.00716.56
7.4.210.0050.01016.48
7.4.200.0000.01016.56
7.4.190.0070.00016.70
7.4.160.0060.00916.62
7.4.150.0180.00617.40
7.4.140.0110.01417.86
7.4.130.0120.00516.58
7.4.120.0100.00716.61
7.4.110.0000.01716.54
7.4.100.0110.00716.62
7.4.90.0130.00616.32
7.4.80.0150.00619.39
7.4.70.0110.00716.36
7.4.60.0110.00716.24
7.4.50.0030.00316.34
7.4.40.0000.01522.77
7.4.30.0150.00316.61
7.4.00.0050.01114.99
7.3.330.0000.00513.39
7.3.320.0050.00013.29
7.3.310.0070.00016.44
7.3.300.0000.00716.35
7.3.290.0100.00316.49
7.3.280.0070.01016.42
7.3.270.0100.00717.40
7.3.260.0130.00416.35
7.3.250.0080.01416.45
7.3.240.0090.00916.61
7.3.230.0070.01116.39
7.3.210.0040.01616.29
7.3.200.0080.00819.39
7.3.190.0150.00616.39
7.3.180.0110.00616.59
7.3.170.0130.00316.49
7.3.160.0180.00316.51
7.3.120.0040.01314.70
7.3.110.0040.01414.85
7.3.100.0040.00415.07
7.3.90.0100.00714.85
7.3.80.0000.01514.80
7.3.70.0070.00714.79
7.3.60.0060.00614.85
7.3.50.0030.01314.98
7.3.40.0060.00914.66
7.3.30.0090.00614.58
7.3.20.0100.00716.75
7.3.10.0070.00716.61
7.3.00.0040.01016.51
7.2.330.0070.01116.32
7.2.320.0130.00516.43
7.2.310.0100.01316.82
7.2.300.0030.01316.63
7.2.290.0030.01416.76
7.2.250.0090.00914.82
7.2.240.0130.00314.96
7.2.230.0070.01415.05
7.2.220.0040.00814.85
7.2.210.0000.01515.12
7.2.200.0030.01014.95
7.2.190.0060.00614.96
7.2.180.0000.01415.07
7.2.170.0060.00915.05
7.2.130.0060.00616.75
7.2.120.0100.00316.51
7.2.110.0100.00616.68
7.2.100.0080.00316.91
7.2.90.0030.01316.97
7.2.80.0040.00416.78
7.2.70.0000.00816.72
7.2.60.0040.00616.74
7.2.50.0070.00516.83
7.2.40.0060.00616.64
7.2.30.0100.00716.61
7.2.20.0060.00917.01
7.2.10.0070.01116.57
7.2.00.0070.00617.96
7.1.330.0100.00315.71
7.1.320.0060.00315.64
7.1.310.0130.00015.50
7.1.300.0030.01015.54
7.1.290.0070.00415.77
7.1.280.0090.00615.84
7.1.270.0090.00315.55
7.1.260.0040.00815.78
7.1.250.0060.00615.80
7.1.200.0100.00315.62
7.1.70.0080.00016.79
7.1.60.0060.00617.34
7.1.50.0160.01334.80
7.1.00.0030.04322.40
7.0.200.0030.01216.62
7.0.140.0000.07722.00
7.0.60.0070.08320.11
7.0.50.0130.07717.87
7.0.40.0170.07319.96
7.0.30.0270.08320.16
7.0.20.0270.08020.20
7.0.10.0400.06020.21
7.0.00.0030.09020.10
5.6.280.0030.07321.07
5.6.210.0100.08320.77
5.6.200.0070.05318.29
5.6.190.0030.06020.66
5.6.180.0170.05320.50
5.6.170.0400.03320.54
5.6.160.0100.08320.50
5.6.150.0030.08318.27
5.6.140.0130.04318.18
5.6.130.0030.08718.16
5.6.120.0000.04320.98
5.6.110.0000.06320.94
5.6.100.0100.08020.98
5.6.90.0070.04720.96
5.6.80.0000.04320.34
5.6.70.0230.06020.35
5.5.350.0000.04320.43
5.5.340.0030.04317.94
5.5.330.0070.06020.43
5.5.320.0100.04720.28
5.5.310.0300.05720.24
5.5.300.0070.03717.96
5.5.290.0000.05318.07
5.5.280.0000.06720.75
5.5.270.0070.04720.86
5.5.260.0070.08020.68
5.5.250.0130.08020.79
5.5.240.0000.05720.16
5.4.450.0630.06319.46
5.4.440.0930.05719.48
5.4.430.0870.06719.38
5.4.420.1100.05319.16
5.4.410.0800.06319.21
5.4.400.0330.05318.76
5.4.390.0430.06718.80
5.4.380.0230.05318.57
5.4.370.0100.05718.59
5.4.360.0200.04718.75
5.4.350.0060.04812.02
5.4.340.0080.04312.02
5.4.320.0050.04012.50
5.4.310.0060.04612.50
5.4.300.0060.05212.50
5.4.290.0080.05212.50
5.4.280.0030.03812.40
5.4.270.0070.03612.40
5.4.260.0060.04112.39
5.4.250.0030.06318.79
5.4.240.0170.05718.96
5.4.230.0270.04719.09
5.4.220.0100.05318.96
5.4.210.0200.05318.94
5.4.200.0200.04718.99
5.4.190.0200.05718.95
5.4.180.0200.04318.99
5.4.170.0000.06318.83
5.4.160.0130.06318.92
5.4.150.0070.05719.08
5.4.140.0130.05316.45
5.4.130.0170.04016.51
5.4.120.0130.05316.36
5.4.110.0130.05716.67
5.4.100.0100.06016.42
5.4.90.0030.05716.70
5.4.80.0100.05016.52
5.4.70.0100.05716.55
5.4.60.0130.06316.33
5.4.50.0170.04016.36
5.4.40.0170.04016.55
5.4.30.0170.05316.38
5.4.20.0100.04716.47
5.4.10.0170.05316.50
5.4.00.0030.05315.82
5.3.290.0080.03712.80
5.3.280.0070.05714.69
5.3.270.0070.07014.75
5.3.260.0070.05314.70
5.3.250.0170.05014.60
5.3.240.0230.06714.58
5.3.230.0100.07714.51
5.3.220.0030.05714.58
5.3.210.0170.04714.75
5.3.200.0100.05014.71
5.3.190.0070.07014.67
5.3.180.0200.06014.57
5.3.170.0030.07014.59
5.3.160.0170.04714.59
5.3.150.0170.06014.70
5.3.140.0100.04714.39
5.3.130.0030.06314.64
5.3.120.0070.06314.65
5.3.110.0100.05014.69
5.3.100.0030.05014.12
5.3.90.0100.05014.11
5.3.80.0030.05313.99
5.3.70.0070.05314.24
5.3.60.0100.06314.08
5.3.50.0070.05314.04
5.3.40.0070.06013.86
5.3.30.0070.07013.82
5.3.20.0130.04013.92
5.3.10.0070.06013.87
5.3.00.0100.06713.73
5.2.170.0130.05011.14
5.2.160.0030.04311.13
5.2.150.0100.05011.23
5.2.140.0030.04011.21
5.2.130.0100.03711.06
5.2.120.0170.03011.32
5.2.110.0000.04311.09
5.2.100.0030.04011.24
5.2.90.0100.03311.33
5.2.80.0130.05311.18
5.2.70.0000.04711.17
5.2.60.0100.03311.14
5.2.50.0030.04311.20
5.2.40.0070.05710.91
5.2.30.0130.03310.89
5.2.20.0100.04711.02
5.2.10.0000.04310.95
5.2.00.0000.06310.64
5.1.60.0070.0479.84
5.1.50.0000.0439.92
5.1.40.0070.04710.23
5.1.30.0030.04010.50
5.1.20.0170.02710.43
5.1.10.0070.0379.91
5.1.00.0100.03010.17
5.0.50.0070.0278.64
5.0.40.0030.0338.66
5.0.30.0000.0638.34
5.0.20.0030.0308.27
5.0.10.0000.0338.38
5.0.00.0030.0478.27
4.4.90.0030.0307.39
4.4.80.0030.0177.39
4.4.70.0030.0207.39
4.4.60.0100.0207.39
4.4.50.0030.0277.39
4.4.40.0030.0337.39
4.4.30.0030.0207.39
4.4.20.0100.0177.39
4.4.10.0030.0237.39
4.4.00.0070.0337.39
4.3.110.0100.0177.39
4.3.100.0070.0207.39
4.3.90.0100.0177.39
4.3.80.0070.0377.39
4.3.70.0070.0237.39
4.3.60.0070.0277.39
4.3.50.0000.0277.39
4.3.40.0070.0307.39
4.3.30.0030.0277.39
4.3.20.0000.0277.39
4.3.10.0070.0237.39
4.3.00.0000.0235.87

preferences:
40.69 ms | 401 KiB | 5 Q