3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* Challenge 1: Read and write to 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 Intercept { public function getKey($test) { print_r($test[0]); } } $intercept = new Intercept; $intercept->getKey($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.0060.00916.75
8.3.60.0150.00618.43
8.3.50.0100.00821.95
8.3.40.0120.00618.63
8.3.30.0120.00618.98
8.3.20.0040.01120.39
8.3.10.0040.00423.65
8.3.00.0130.00619.38
8.2.180.0120.00318.54
8.2.170.0110.00422.96
8.2.160.0120.00320.47
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0080.00022.12
8.2.110.0000.00919.27
8.2.100.0080.00817.69
8.2.90.0040.00418.15
8.2.80.0040.00417.97
8.2.70.0030.00617.63
8.2.60.0040.00419.65
8.2.50.0000.00818.07
8.2.40.0030.00620.01
8.2.30.0070.00218.08
8.2.20.0030.00517.70
8.2.10.0080.00018.12
8.2.00.0030.00717.75
8.1.280.0180.00425.92
8.1.270.0150.00022.19
8.1.260.0070.00026.35
8.1.250.0080.00028.09
8.1.240.0040.00419.21
8.1.230.0110.00021.04
8.1.220.0050.00317.74
8.1.210.0040.00418.86
8.1.200.0040.00417.35
8.1.190.0000.00817.53
8.1.180.0030.00618.10
8.1.170.0060.00318.34
8.1.160.0000.00721.89
8.1.150.0060.00318.55
8.1.140.0050.00217.39
8.1.130.0040.00417.82
8.1.120.0040.00417.36
8.1.110.0000.00917.42
8.1.100.0040.00417.38
8.1.90.0000.00717.37
8.1.80.0040.00417.45
8.1.70.0050.00317.29
8.1.60.0000.00817.55
8.1.50.0080.00017.59
8.1.40.0040.00417.42
8.1.30.0040.00417.66
8.1.20.0000.00717.70
8.1.10.0000.00717.48
8.1.00.0040.00417.52
8.0.300.0000.00720.16
8.0.290.0050.00217.05
8.0.280.0030.00318.28
8.0.270.0000.00817.08
8.0.260.0000.00717.22
8.0.250.0050.00317.01
8.0.240.0000.00816.99
8.0.230.0020.00516.89
8.0.220.0040.00416.88
8.0.210.0000.01016.84
8.0.200.0060.00016.80
8.0.190.0050.00316.99
8.0.180.0040.00416.98
8.0.170.0040.00416.84
8.0.160.0030.00516.93
8.0.150.0000.00716.71
8.0.140.0000.00716.91
8.0.130.0060.00313.36
8.0.120.0000.00816.79
8.0.110.0000.00716.89
8.0.100.0080.00016.79
8.0.90.0070.00016.96
8.0.80.0070.01016.97
8.0.70.0040.00416.77
8.0.60.0000.00816.97
8.0.50.0040.00416.79
8.0.30.0110.00816.93
8.0.20.0140.00717.40
8.0.10.0070.00016.83
8.0.00.0120.00816.85
7.4.330.0050.00015.00
7.4.320.0000.00716.60
7.4.300.0030.00316.57
7.4.290.0030.00516.59
7.4.280.0070.00016.54
7.4.270.0040.00316.51
7.4.260.0030.00316.52
7.4.250.0050.00316.55
7.4.240.0030.00316.52
7.4.230.0000.00716.52
7.4.220.0060.01216.57
7.4.210.0090.00616.58
7.4.200.0000.00816.26
7.4.190.0030.00316.72
7.4.160.0070.01016.37
7.4.150.0070.01017.40
7.4.140.0110.00817.86
7.4.130.0140.00516.58
7.4.120.0050.01216.42
7.4.110.0130.00616.44
7.4.100.0090.00916.52
7.4.90.0270.01716.44
7.4.80.0050.02119.39
7.4.70.0110.01116.48
7.4.60.0120.00416.48
7.4.50.0040.00416.54
7.4.40.0000.01722.77
7.4.30.0060.01016.69
7.4.00.0040.00414.95
7.3.330.0000.00713.43
7.3.320.0030.00313.19
7.3.310.0030.00316.46
7.3.300.0040.00416.41
7.3.290.0040.01116.45
7.3.280.0140.00416.35
7.3.270.0110.00617.40
7.3.260.0030.01516.61
7.3.250.0050.01416.37
7.3.240.0030.01516.61
7.3.230.0040.01916.39
7.3.210.0190.00016.39
7.3.200.0120.00619.39
7.3.190.0110.01116.14
7.3.180.0030.01316.62
7.3.170.0090.00616.27
7.3.160.0110.00716.45
7.3.120.0040.01114.52
7.2.330.0070.01016.75
7.2.320.0040.01416.63
7.2.310.0120.00916.40
7.2.300.0070.01016.30
7.2.290.0030.01216.39
7.2.60.0090.00616.99
7.2.00.0030.01319.51
7.1.200.0080.00615.62
7.1.100.0030.01018.12
7.1.70.0060.00316.80
7.1.60.0080.01219.46
7.1.50.0110.01416.61
7.1.00.0070.07022.27
7.0.200.0000.00816.72
7.0.140.0100.07021.95
7.0.60.0070.06319.98
7.0.50.0000.05017.86
7.0.40.0070.08320.02
7.0.30.0230.05720.17
7.0.20.0270.09020.23
7.0.10.0300.08020.15
7.0.00.0030.08720.25
5.6.280.0000.07721.03
5.6.210.0030.05720.67
5.6.200.0070.08018.25
5.6.190.0070.04320.39
5.6.180.0330.07720.48
5.6.170.0370.04720.57
5.6.160.0030.04720.62
5.6.150.0030.08318.14
5.6.140.0070.04018.21
5.6.130.0070.07318.18
5.6.120.0070.08320.98
5.6.110.0030.04021.09
5.6.100.0030.07320.97
5.6.90.0030.04721.08
5.6.80.0070.04020.33
5.6.70.0230.08320.37
5.5.350.0030.08320.33
5.5.340.0130.05317.99
5.5.330.0030.06020.31
5.5.320.0230.07720.27
5.5.310.0170.04720.27
5.5.300.0100.04717.95
5.5.290.0070.07717.97
5.5.280.0030.05320.66
5.5.270.0000.04320.98
5.5.260.0070.08020.68
5.5.250.0070.04320.58
5.5.240.0130.07720.38
5.4.450.0830.07319.30
5.4.440.0500.05319.48
5.4.430.0900.05719.56
5.4.420.0800.05019.44
5.4.410.0630.06719.43
5.4.400.0900.06719.14
5.4.390.0170.07018.96
5.4.380.0200.06018.59
5.4.370.0100.06018.80
5.4.360.0270.05718.71
5.4.350.0170.07018.73
5.4.340.0330.06018.79
5.4.320.0090.04312.50
5.4.310.0060.04112.50
5.4.300.0100.03912.51
5.4.290.0070.05512.48
5.4.280.0040.03712.39
5.4.270.0060.03612.39
5.4.260.0060.03812.39
5.4.250.0060.03812.38
5.4.240.0050.04312.38
5.4.230.0080.03612.38
5.4.220.0040.03712.38
5.4.210.0090.03312.38
5.4.200.0030.04112.37
5.4.190.0080.05212.37
5.4.180.0070.05112.37
5.4.170.0040.03912.38
5.4.160.0080.03412.38
5.4.150.0040.03812.37
5.4.140.0060.03912.06
5.4.130.0050.03812.04
5.4.120.0050.03612.00
5.4.110.0100.03412.00
5.4.100.0040.03912.00
5.4.90.0080.04012.00
5.4.80.0080.03512.00
5.4.70.0080.03211.99
5.4.60.0040.03711.99
5.4.50.0110.03911.99
5.4.40.0050.03511.99
5.4.30.0080.03711.98
5.4.20.0070.03511.98
5.4.10.0060.03511.98
5.4.00.0070.03611.47
5.3.290.0060.04712.80
5.3.280.0070.03912.71
5.3.270.0100.04412.73
5.3.260.0080.04712.72
5.3.250.0070.03712.72
5.3.240.0070.03712.71
5.3.230.0070.03712.71
5.3.220.0070.04812.68
5.3.210.0040.05612.68
5.3.200.0120.03112.68
5.3.190.0080.03912.68
5.3.180.0070.03712.68
5.3.170.0100.03512.67
5.3.160.0050.03812.67
5.3.150.0080.03612.68
5.3.140.0100.03212.66
5.3.130.0100.03812.66
5.3.120.0130.03812.66
5.3.110.0090.04212.66
5.3.100.0060.04112.13
5.3.90.0080.03312.11
5.3.80.0040.03712.10
5.3.70.0070.03512.10
5.3.60.0050.03812.08
5.3.50.0070.03612.04
5.3.40.0090.03312.04
5.3.30.0060.03512.00
5.3.20.0100.03511.77
5.3.10.0070.03311.74
5.3.00.0050.03611.72
5.2.170.0040.0319.23
5.2.160.0050.0299.23
5.2.150.0050.0309.23
5.2.140.0050.0319.22
5.2.130.0050.0299.18
5.2.120.0020.0319.18
5.2.110.0050.0289.20
5.2.100.0040.0319.20
5.2.90.0080.0269.19
5.2.80.0060.0289.18
5.2.70.0070.0279.19
5.2.60.0050.0339.14
5.2.50.0040.0319.11
5.2.40.0060.0289.08
5.2.30.0050.0299.06
5.2.20.0060.0289.05
5.2.10.0070.0388.95
5.2.00.0080.0398.82
5.1.60.0050.0278.10
5.1.50.0070.0268.09
5.1.40.0050.0258.08
5.1.30.0010.0298.43
5.1.20.0030.0288.45
5.1.10.0060.0248.17
5.1.00.0060.0248.17
5.0.50.0020.0226.66
5.0.40.0040.0196.52
5.0.30.0030.0356.33
5.0.20.0040.0246.29
5.0.10.0040.0216.28
5.0.00.0030.0336.27
4.4.90.0050.0204.78
4.4.80.0040.0154.75
4.4.70.0010.0184.75
4.4.60.0060.0184.76
4.4.50.0030.0184.77
4.4.40.0030.0284.71
4.4.30.0040.0174.76
4.4.20.0030.0184.84
4.4.10.0060.0154.85
4.4.00.0030.0264.76
4.3.110.0010.0184.67
4.3.100.0020.0164.66
4.3.90.0020.0164.64
4.3.80.0040.0254.59
4.3.70.0080.0264.63
4.3.60.0030.0234.63
4.3.50.0040.0234.63
4.3.40.0030.0344.54
4.3.30.0010.0183.30
4.3.20.0010.0183.28
4.3.10.0020.0173.24
4.3.00.0030.01310.54

preferences:
69.16 ms | 401 KiB | 5 Q