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; reset($array); $first_key = key($array); print_r($first_key); /* 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.70.0120.00618.55
8.3.60.0120.00316.63
8.3.50.0110.00622.12
8.3.40.0170.00318.76
8.3.30.0070.00719.08
8.3.20.0000.00720.39
8.3.10.0040.00423.71
8.3.00.0060.00319.38
8.2.180.0110.01118.37
8.2.170.0100.01022.96
8.2.160.0040.01120.39
8.2.150.0040.00424.18
8.2.140.0030.01024.66
8.2.130.0090.00026.16
8.2.120.0000.00822.13
8.2.110.0030.00721.00
8.2.100.0110.00017.72
8.2.90.0040.00417.63
8.2.80.0030.00517.97
8.2.70.0040.00417.50
8.2.60.0040.00417.91
8.2.50.0090.00318.07
8.2.40.0030.00519.74
8.2.30.0000.00918.13
8.2.20.0000.00817.69
8.2.10.0000.00717.87
8.2.00.0040.00417.56
8.1.280.0110.00425.92
8.1.270.0080.00022.00
8.1.260.0080.00026.35
8.1.250.0000.00828.09
8.1.240.0100.01020.73
8.1.230.0000.01122.00
8.1.220.0000.00817.74
8.1.210.0060.00318.77
8.1.200.0030.00617.23
8.1.190.0040.00417.40
8.1.180.0050.00518.10
8.1.170.0000.01018.59
8.1.160.0000.00722.00
8.1.150.0040.00718.48
8.1.140.0000.00717.33
8.1.130.0030.00317.75
8.1.120.0030.00317.45
8.1.110.0030.00817.28
8.1.100.0040.00417.29
8.1.90.0070.00017.44
8.1.80.0070.00017.39
8.1.70.0000.00717.39
8.1.60.0050.00317.47
8.1.50.0000.00917.41
8.1.40.0000.00917.55
8.1.30.0000.00817.52
8.1.20.0000.00717.61
8.1.10.0000.00717.59
8.1.00.0040.00417.55
8.0.300.0000.00719.69
8.0.290.0040.00417.04
8.0.280.0000.00818.50
8.0.270.0000.00817.21
8.0.260.0030.00317.11
8.0.250.0030.00317.02
8.0.240.0040.00416.92
8.0.230.0080.00016.96
8.0.220.0000.00716.87
8.0.210.0000.00816.88
8.0.200.0000.00616.95
8.0.190.0040.00416.95
8.0.180.0070.00016.95
8.0.170.0040.00416.94
8.0.160.0000.00816.84
8.0.150.0040.00416.96
8.0.140.0000.00716.89
8.0.130.0020.00513.36
8.0.120.0080.00016.74
8.0.110.0000.00816.79
8.0.100.0000.00716.96
8.0.90.0030.00516.77
8.0.80.0160.00016.87
8.0.70.0080.00016.89
8.0.60.0030.00516.86
8.0.50.0040.00416.88
8.0.30.0170.00517.20
8.0.20.0090.00917.40
8.0.10.0050.00316.95
8.0.00.0170.01316.84
7.4.330.0020.00215.00
7.4.320.0030.00316.58
7.4.300.0030.00316.55
7.4.290.0030.00316.46
7.4.280.0030.00316.50
7.4.270.0000.00816.41
7.4.260.0060.00016.58
7.4.250.0030.00616.51
7.4.240.0040.00316.61
7.4.230.0030.00316.69
7.4.220.0090.00916.55
7.4.210.0070.00716.52
7.4.200.0050.00316.48
7.4.190.0040.00416.38
7.4.160.0130.00316.63
7.4.150.0130.00617.40
7.4.140.0030.01417.86
7.4.130.0080.00916.44
7.4.120.0080.01316.47
7.4.110.0100.00716.37
7.4.100.0140.01016.66
7.4.90.0120.00816.53
7.4.80.0110.01419.39
7.4.70.0100.00616.63
7.4.60.0120.00916.57
7.4.50.0000.00916.42
7.4.40.0030.00822.77
7.4.30.0070.01316.44
7.4.00.0050.01114.89
7.3.330.0000.00713.19
7.3.320.0030.00313.17
7.3.310.0040.00416.40
7.3.300.0030.00616.29
7.3.290.0140.00016.39
7.3.280.0130.00616.34
7.3.270.0070.01117.40
7.3.260.0100.01316.34
7.3.250.0070.01116.49
7.3.240.0140.00316.36
7.3.230.0150.00816.55
7.3.210.0090.01516.34
7.3.200.0160.00419.39
7.3.190.0100.00716.38
7.3.180.0060.01016.53
7.3.170.0150.00016.52
7.3.160.0100.00516.40
7.3.120.0050.01214.87
7.3.110.0090.00914.95
7.3.100.0070.00714.73
7.3.90.0130.00314.54
7.3.80.0110.00414.75
7.3.70.0000.01614.68
7.3.60.0090.00314.65
7.3.50.0060.00614.57
7.3.40.0000.01314.73
7.3.30.0150.00014.61
7.3.20.0090.00016.54
7.3.10.0040.01116.49
7.3.00.0110.00316.51
7.2.330.0090.00916.86
7.2.320.0030.01416.70
7.2.310.0160.00616.38
7.2.300.0250.02016.77
7.2.290.0030.01316.54
7.2.250.0070.01315.21
7.2.240.0060.00915.02
7.2.230.0070.01014.82
7.2.220.0030.01214.88
7.2.210.0030.01314.74
7.2.200.0060.00915.20
7.2.190.0060.00314.77
7.2.180.0040.00714.83
7.2.170.0070.00715.14
7.2.60.0000.01216.93
7.1.330.0000.01315.65
7.1.320.0060.00615.53
7.1.310.0070.00715.70
7.1.300.0030.00715.71
7.1.290.0030.01015.56
7.1.280.0000.01215.49
7.1.270.0000.01315.70
7.1.260.0110.00315.70
7.1.200.0040.01115.59
7.1.70.0000.00917.08
7.1.60.0090.01619.46
7.1.50.0070.01816.86
7.1.00.0030.07722.36
7.0.200.0040.00416.45
7.0.140.0100.06721.93
7.0.60.0100.06319.88
7.0.50.0000.05317.86
7.0.40.0070.06020.05
7.0.30.0300.04320.09
7.0.20.0330.08320.09
7.0.10.0030.04320.33
7.0.00.0070.04020.14
5.6.280.0000.07721.18
5.6.210.0070.03720.52
5.6.200.0000.09018.22
5.6.190.0000.05020.42
5.6.180.0170.04320.48
5.6.170.0230.04020.47
5.6.160.0130.07020.57
5.6.150.0070.08318.18
5.6.140.0130.04718.14
5.6.130.0000.04318.18
5.6.120.0070.07020.97
5.6.110.0100.06320.89
5.6.100.0100.04021.01
5.6.90.0130.06720.96
5.6.80.0000.07720.41
5.6.70.4600.03720.43
5.5.350.0200.08020.43
5.5.340.0070.06717.99
5.5.330.0030.06320.30
5.5.320.0370.06020.29
5.5.310.0270.05020.42
5.5.300.0070.07018.06
5.5.290.0100.08318.08
5.5.280.0030.04320.89
5.5.270.0170.07320.86
5.5.260.0030.08720.68
5.5.250.0100.08020.59
5.5.240.0300.07320.29
5.4.450.0830.05319.18
5.4.440.0770.06019.31
5.4.430.0700.06019.66
5.4.420.0130.05719.56
5.4.410.0770.06319.31
5.4.400.0130.06019.12
5.4.390.0400.05319.22
5.4.380.0370.07318.66
5.4.370.0270.05718.53
5.4.360.0330.04318.77
5.4.350.0330.06018.50
5.4.340.0400.05018.48
5.4.320.0050.03712.50
5.4.310.0070.04012.50
5.4.300.0070.04512.50
5.4.290.0060.04012.48
5.4.280.0070.03612.39
5.4.270.0050.03912.38
5.4.260.0050.04112.38
5.4.250.0110.05112.38
5.4.240.0080.03812.38
5.4.230.0130.03812.38
5.4.220.0080.05112.37
5.4.210.0060.04912.37
5.4.200.0090.04512.37
5.4.190.0050.04612.37
5.4.180.0060.04312.38
5.4.170.0090.03912.38
5.4.160.0100.03712.38
5.4.150.0080.03912.38
5.4.140.0050.04112.06
5.4.130.0100.03512.05
5.4.120.0080.03812.00
5.4.110.0080.03912.00
5.4.100.0070.04012.00
5.4.90.0090.05012.00
5.4.80.0100.04712.00
5.4.70.0100.03412.00
5.4.60.0060.03812.00
5.4.50.0040.03912.00
5.4.40.0080.03611.99
5.4.30.0050.04011.98
5.4.20.0130.06111.98
5.4.10.0080.05111.98
5.4.00.0080.05511.47
5.3.290.0090.04112.80
5.3.280.0080.03612.71
5.3.270.0060.03912.72
5.3.260.0060.03912.72
5.3.250.0050.04112.72
5.3.240.0090.04112.72
5.3.230.0090.03812.71
5.3.220.0060.04212.68
5.3.210.0090.03712.68
5.3.200.0080.03612.68
5.3.190.0070.03912.68
5.3.180.0090.04012.67
5.3.170.0040.04212.67
5.3.160.0060.05712.67
5.3.150.0070.03912.67
5.3.140.0070.04012.66
5.3.130.0100.07812.65
5.3.120.0080.07412.66
5.3.110.0080.07112.66
5.3.100.0120.06212.12
5.3.90.0070.04512.11
5.3.80.0070.04012.10
5.3.70.0040.04612.10
5.3.60.0070.04312.08
5.3.50.0060.04012.03
5.3.40.0050.03912.03
5.3.30.0060.04011.99
5.3.20.0110.04911.77
5.3.10.0110.07511.74
5.3.00.0070.04111.72
5.2.170.0050.0409.22
5.2.160.0100.0539.23
5.2.150.0070.0309.22
5.2.140.0060.0319.22
5.2.130.0070.0309.18
5.2.120.0050.0479.18
5.2.110.0070.0349.19
5.2.100.0050.0379.19
5.2.90.0090.0429.19
5.2.80.0040.0389.18
5.2.70.0070.0329.18
5.2.60.0070.0339.14
5.2.50.0080.0579.11
5.2.40.0050.0359.08
5.2.30.0060.0359.06
5.2.20.0070.0289.04
5.2.10.0040.0338.95
5.2.00.0040.0448.81
5.1.60.0170.0538.10
5.1.50.0050.0338.09
5.1.40.0100.0308.08
5.1.30.0080.0378.43
5.1.20.0250.0788.44
5.1.10.0060.0288.18
5.1.00.0040.0308.17
5.0.50.0090.0256.65
5.0.40.0050.0246.51
5.0.30.0020.0366.32
5.0.20.0030.0236.29
5.0.10.0060.0236.27
5.0.00.0030.0376.26
4.4.90.0040.0164.78
4.4.80.0060.0194.75
4.4.70.0070.0234.75
4.4.60.0000.0254.76
4.4.50.0050.0214.77
4.4.40.0090.0464.71
4.4.30.0030.0274.75
4.4.20.0030.0174.84
4.4.10.0030.0284.85
4.4.00.0040.0294.76
4.3.110.0040.0154.66
4.3.100.0040.0244.67
4.3.90.0000.0194.63
4.3.80.0040.0244.58
4.3.70.0040.0224.63
4.3.60.0020.0204.63
4.3.50.0030.0174.63
4.3.40.0050.0234.54
4.3.30.0020.0163.30
4.3.20.0030.0183.28
4.3.10.0010.0173.23
4.3.00.0000.02010.54

preferences:
50.29 ms | 401 KiB | 5 Q