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) { $array = (array) $test; print_r($array[Testsecret]); foreach($array as $k => $v) { print_r($k); print_r($v); } } } $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.60.0080.00816.88
8.3.50.0100.01022.02
8.3.40.0040.01118.79
8.3.30.0060.00919.22
8.3.20.0070.00020.07
8.3.10.0070.00321.71
8.3.00.0110.00719.38
8.2.180.0040.01118.41
8.2.170.0160.00622.96
8.2.160.0140.00720.44
8.2.150.0080.00024.18
8.2.140.0070.00024.66
8.2.130.0080.01226.16
8.2.120.0050.00322.31
8.2.110.0030.00720.53
8.2.100.0090.00317.91
8.2.90.0040.00418.28
8.2.80.0040.00418.03
8.2.70.0050.00317.63
8.2.60.0080.00017.93
8.2.50.0040.00418.07
8.2.40.0000.00819.82
8.2.30.0040.00417.95
8.2.20.0040.00417.76
8.2.10.0000.00717.95
8.2.00.0000.00817.63
8.1.280.0140.00725.92
8.1.270.0080.00023.91
8.1.260.0030.00626.35
8.1.250.0030.00628.09
8.1.240.0040.00421.93
8.1.230.0070.00320.84
8.1.220.0060.00317.74
8.1.210.0080.00018.96
8.1.200.0060.00317.47
8.1.190.0040.00417.53
8.1.180.0030.00618.10
8.1.170.0040.00418.44
8.1.160.0050.00222.07
8.1.150.0000.00718.71
8.1.140.0000.00717.46
8.1.130.0040.00417.84
8.1.120.0050.00217.39
8.1.110.0030.00717.51
8.1.100.0030.00717.43
8.1.90.0070.00017.44
8.1.80.0000.00717.49
8.1.70.0040.00417.45
8.1.60.0040.00417.52
8.1.50.0000.00817.40
8.1.40.0080.00017.52
8.1.30.0030.00517.58
8.1.20.0040.00417.65
8.1.10.0040.00417.59
8.1.00.0000.00717.41
8.0.300.0040.00420.08
8.0.290.0000.00717.05
8.0.280.0070.00018.48
8.0.270.0040.00417.28
8.0.260.0000.00617.28
8.0.250.0000.00717.05
8.0.240.0000.00817.04
8.0.230.0000.00716.99
8.0.220.0030.00317.02
8.0.210.0040.00416.88
8.0.200.0000.00617.01
8.0.190.0040.00416.99
8.0.180.0060.00316.92
8.0.170.0040.00417.02
8.0.160.0080.00016.98
8.0.150.0000.00716.96
8.0.140.0000.00716.95
8.0.130.0000.00613.46
8.0.120.0000.00816.95
8.0.110.0040.00417.02
8.0.100.0080.00017.00
8.0.90.0040.00317.02
8.0.80.0060.00917.04
8.0.70.0040.00417.04
8.0.60.0000.00717.09
8.0.50.0000.00716.93
8.0.30.0110.01217.26
8.0.20.0170.00217.40
8.0.10.0000.00717.04
8.0.00.0100.01216.71
7.4.330.0050.00015.00
7.4.320.0070.00016.56
7.4.300.0030.00316.42
7.4.290.0070.00016.53
7.4.280.0000.00716.62
7.4.270.0040.00416.61
7.4.260.0040.00416.49
7.4.250.0080.00016.57
7.4.240.0000.00716.51
7.4.230.0050.00216.57
7.4.220.0100.00716.64
7.4.210.0090.00516.57
7.4.200.0030.00316.49
7.4.190.0040.00416.75
7.4.160.0120.00616.52
7.4.150.0150.00517.40
7.4.140.0120.00817.86
7.4.130.0130.00316.58
7.4.120.0070.00916.62
7.4.110.0030.01416.70
7.4.100.0030.01616.54
7.4.90.0030.01616.70
7.4.80.0060.01219.39
7.4.70.0040.01216.71
7.4.60.0130.00316.59
7.4.50.0050.00016.32
7.4.40.0080.00622.77
7.4.30.0140.00316.62
7.4.00.0120.00415.14
7.3.330.0000.00713.37
7.3.320.0000.00713.26
7.3.310.0000.00716.38
7.3.300.0030.00316.42
7.3.290.0070.00716.35
7.3.280.0110.00616.36
7.3.270.0070.01117.40
7.3.260.0140.00416.41
7.3.250.0160.00716.57
7.3.240.0000.01816.63
7.3.230.0110.00616.49
7.3.210.0030.01416.46
7.3.200.0090.01319.39
7.3.190.0140.00916.36
7.3.180.0060.01316.46
7.3.170.0110.00616.59
7.3.160.0050.01016.49
7.3.120.0030.01214.87
7.2.330.0060.01316.70
7.2.320.0100.00716.71
7.2.310.0070.01016.82
7.2.300.0030.01416.53
7.2.290.0070.01016.55
7.2.60.0070.01016.92
7.2.00.0060.00619.51
7.1.200.0080.00415.95
7.1.100.0030.01018.09
7.1.70.0000.00817.19
7.1.60.0060.01919.46
7.1.50.0130.02034.89
7.1.00.0070.07322.36
7.0.200.0130.00714.87
7.0.140.0030.07022.11
7.0.60.0070.05720.02
7.0.50.0100.05717.89
7.0.40.0100.09020.18
7.0.30.0430.04320.12
7.0.20.0770.06020.25
7.0.10.0030.04720.22
7.0.00.0130.08020.19
5.6.280.0030.07320.93
5.6.210.0130.07320.55
5.6.200.0100.08018.18
5.6.190.0130.07320.52
5.6.180.0500.07720.48
5.6.170.0330.07720.51
5.6.160.0030.06720.48
5.6.150.0000.04018.23
5.6.140.0130.06018.18
5.6.130.0170.07318.27
5.6.120.0200.06720.98
5.6.110.0200.06720.94
5.6.100.0100.08320.98
5.6.90.0170.07321.11
5.6.80.0000.04320.36
5.5.350.0530.06320.53
5.5.340.0000.09317.93
5.5.330.0030.08720.13
5.5.320.0100.06320.38
5.5.310.0270.06020.27
5.5.300.0070.03717.98
5.5.290.0030.06018.06
5.5.280.0130.07720.91
5.5.270.0070.08320.82
5.5.260.0130.07320.97
5.5.250.0100.08020.69
5.5.240.0130.05720.27
5.4.450.0400.06019.16
5.4.440.0170.05319.43
5.4.430.0070.06019.68
5.4.420.0100.06019.52
5.4.410.0200.04319.41
5.4.400.0130.06319.25
5.4.390.0030.06019.02
5.4.380.0370.06318.75
5.4.370.0470.04718.78
5.4.360.0430.06318.78
5.4.350.0370.05718.58
5.4.340.0430.05318.57
5.4.320.0080.03812.51
5.4.310.0080.04212.50
5.4.300.0060.03712.51
5.4.290.0060.03712.49
5.4.280.0040.03712.38
5.4.270.0050.03712.38
5.4.260.0060.03612.38
5.4.250.0050.03812.38
5.4.240.0090.03412.38
5.4.230.0070.03712.37
5.4.220.0030.04012.38
5.4.210.0060.03712.38
5.4.200.0080.03912.38
5.4.190.0040.04112.37
5.4.180.0080.03712.38
5.4.170.0070.03812.38
5.4.160.0090.03312.38
5.4.150.0070.03612.38
5.4.140.0060.03612.06
5.4.130.0070.03412.04
5.4.120.0040.03712.00
5.4.110.0050.04112.00
5.4.100.0070.03512.00
5.4.90.0030.04212.00
5.4.80.0100.04912.00
5.4.70.0070.04112.00
5.4.60.0060.03612.00
5.4.50.0080.04012.00
5.4.40.0050.04111.98
5.4.30.0050.04211.98
5.4.20.0080.04611.98
5.4.10.0060.03411.98
5.4.00.0080.03311.47
5.3.290.0090.03712.80
5.3.280.0030.04212.71
5.3.270.0090.03812.72
5.3.260.0060.04012.71
5.3.250.0090.05312.72
5.3.240.0070.05112.72
5.3.230.0110.04912.71
5.3.220.0090.05212.68
5.3.210.0090.06112.68
5.3.200.0070.06012.68
5.3.190.0080.05512.68
5.3.180.0100.05312.67
5.3.170.0110.05012.67
5.3.160.0080.06112.67
5.3.150.0090.05612.68
5.3.140.0050.05612.66
5.3.130.0080.04012.66
5.3.120.0060.03812.66
5.3.110.0100.03912.66
5.3.100.0080.03512.13
5.3.90.0050.03812.11
5.3.80.0050.03712.10
5.3.70.0050.03712.10
5.3.60.0030.03912.08
5.3.50.0080.03412.05
5.3.40.0060.03712.03
5.3.30.0080.04212.01
5.3.20.0060.04011.77
5.3.10.0040.03811.74
5.3.00.0060.04711.72
5.2.170.0030.0339.23
5.2.160.0060.0349.23
5.2.150.0040.0359.23
5.2.140.0050.0319.22
5.2.130.0100.0259.19
5.2.120.0050.0299.19
5.2.110.0070.0289.19
5.2.100.0050.0299.18
5.2.90.0050.0309.19
5.2.80.0030.0339.19
5.2.70.0060.0299.18
5.2.60.0030.0339.14
5.2.50.0030.0329.10
5.2.40.0080.0269.09
5.2.30.0030.0329.06
5.2.20.0080.0289.04
5.2.10.0050.0288.95
5.2.00.0050.0298.82
5.1.60.0060.0228.10
5.1.50.0050.0338.10
5.1.40.0070.0308.07
5.1.30.0040.0278.42
5.1.20.0040.0278.45
5.1.10.0040.0368.18
5.1.00.0030.0428.18
5.0.50.0020.0316.65
5.0.40.0050.0196.52
5.0.30.0050.0316.32
5.0.20.0060.0216.29
5.0.10.0040.0206.27
5.0.00.0030.0326.26
4.4.90.0030.0164.77
4.4.80.0050.0144.76
4.4.70.0050.0154.76
4.4.60.0010.0184.75
4.4.50.0020.0164.77
4.4.40.0050.0244.71
4.4.30.0030.0184.76
4.4.20.0040.0194.85
4.4.10.0040.0224.85
4.4.00.0030.0344.76
4.3.110.0050.0214.66
4.3.100.0040.0234.66
4.3.90.0060.0194.63
4.3.80.0030.0274.59
4.3.70.0010.0244.63
4.3.60.0030.0214.63
4.3.50.0020.0174.63
4.3.40.0020.0294.54
4.3.30.0030.0233.30
4.3.20.0040.0213.28
4.3.10.0050.0193.23
4.3.00.0170.0236.91

preferences:
54.97 ms | 401 KiB | 5 Q