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 $this->testy = $key; $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($array[$first_key]); $v = array(); $v[$first_key] = 'blah'; $blah = $v[$first_key]; $test->__set($array[$first_key] , $blah[$first_key]['blah']); /* 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.0100.00716.63
8.3.50.0110.00621.99
8.3.40.0100.01018.97
8.3.30.0070.00718.82
8.3.20.0030.00520.26
8.3.10.0080.00023.50
8.3.00.0030.00619.38
8.2.180.0000.01918.29
8.2.170.0110.00722.96
8.2.160.0130.00020.39
8.2.150.0040.00424.18
8.2.140.0050.00224.66
8.2.130.0120.00626.16
8.2.120.0040.00422.32
8.2.110.0070.00321.11
8.2.100.0090.00317.78
8.2.90.0080.00019.22
8.2.80.0030.00517.97
8.2.70.0050.00317.75
8.2.60.0080.00017.93
8.2.50.0080.00018.10
8.2.40.0000.00820.42
8.2.30.0000.00718.10
8.2.20.0070.00017.67
8.2.10.0040.00418.06
8.2.00.0030.00617.75
8.1.280.0070.00725.92
8.1.270.0080.00023.71
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0060.00322.22
8.1.230.0110.00017.89
8.1.220.0050.00317.79
8.1.210.0040.00418.77
8.1.200.0030.00617.23
8.1.190.0050.00317.23
8.1.180.0000.00818.10
8.1.170.0050.00318.46
8.1.160.0000.00722.06
8.1.150.0040.00418.59
8.1.140.0070.00017.31
8.1.130.0040.00417.79
8.1.120.0000.00817.40
8.1.110.0000.00817.39
8.1.100.0040.00317.23
8.1.90.0000.00717.37
8.1.80.0030.00517.36
8.1.70.0030.00317.38
8.1.60.0000.00917.59
8.1.50.0040.00417.47
8.1.40.0040.00417.53
8.1.30.0000.00917.66
8.1.20.0070.00017.66
8.1.10.0040.00417.55
8.1.00.0040.00417.59
8.0.300.0000.00918.77
8.0.290.0050.00516.63
8.0.280.0070.00018.39
8.0.270.0040.00417.20
8.0.260.0000.00717.21
8.0.250.0000.00716.87
8.0.240.0000.00716.88
8.0.230.0040.00416.86
8.0.220.0000.00616.90
8.0.210.0000.01016.94
8.0.200.0000.00616.83
8.0.190.0040.00416.93
8.0.180.0050.00516.80
8.0.170.0080.00016.93
8.0.160.0070.00016.84
8.0.150.0000.00816.74
8.0.140.0050.00316.76
8.0.130.0030.00313.25
8.0.120.0040.00416.87
8.0.110.0040.00416.90
8.0.100.0040.00416.70
8.0.90.0000.00816.80
8.0.80.0070.00716.96
8.0.70.0000.00716.86
8.0.60.0030.00616.77
8.0.50.0050.00316.77
8.0.30.0110.01117.05
8.0.20.0170.00317.41
8.0.10.0050.00217.06
8.0.00.0090.00916.88
7.4.330.0000.00515.00
7.4.320.0000.00716.54
7.4.300.0060.00016.59
7.4.290.0070.00016.53
7.4.280.0000.00816.55
7.4.270.0000.00716.67
7.4.260.0040.00416.59
7.4.250.0000.00716.48
7.4.240.0020.00516.57
7.4.230.0030.00316.73
7.4.220.0090.00916.50
7.4.210.0040.01216.59
7.4.200.0000.00716.37
7.4.190.0040.00416.69
7.4.160.0000.01616.58
7.4.150.0130.00517.40
7.4.140.0070.01017.86
7.4.130.0150.00416.63
7.4.120.0140.00516.67
7.4.110.0040.01416.63
7.4.100.0140.00416.50
7.4.90.0270.01216.71
7.4.80.0180.00819.39
7.4.70.0100.01016.43
7.4.60.0070.01016.44
7.4.50.0030.00316.52
7.4.40.0090.00622.77
7.4.30.0030.01316.46
7.4.00.0060.00914.90
7.3.330.0030.00313.30
7.3.320.0000.00613.38
7.3.310.0020.00516.32
7.3.300.0030.00716.30
7.3.290.0060.00916.39
7.3.280.0080.00916.43
7.3.270.0000.01917.40
7.3.260.0060.01216.69
7.3.250.0130.00716.61
7.3.240.0040.01816.39
7.3.230.0180.00616.50
7.3.210.0160.00716.60
7.3.200.0100.01419.39
7.3.190.0130.00416.25
7.3.180.0040.01116.41
7.3.170.0070.01016.53
7.3.160.0140.00316.55
7.3.120.0030.00914.74
7.2.330.0160.00316.88
7.2.320.0140.00316.75
7.2.310.0110.00616.44
7.2.300.0070.01016.82
7.2.290.0100.00716.58
7.2.60.0080.00817.04
7.1.200.0040.01115.78
7.1.70.0030.00717.15
7.1.60.0000.01119.46
7.1.50.0070.01117.11
7.1.00.0030.07722.48
7.0.200.0000.00716.76
7.0.140.0070.07021.95
7.0.60.0130.07320.04
7.0.50.0030.07017.89
7.0.40.0070.08720.02
7.0.30.0300.07020.21
7.0.20.0300.07320.33
7.0.10.0230.05720.06
7.0.00.0130.08320.11
5.6.280.0030.07321.01
5.6.210.0030.08720.73
5.6.200.0030.08018.16
5.6.190.0130.08020.48
5.6.180.0330.07720.34
5.6.170.0300.07320.55
5.6.160.0030.07720.52
5.6.150.0070.05318.16
5.6.140.0070.08018.23
5.6.130.0130.05718.29
5.6.120.0100.05721.05
5.6.110.0100.08320.86
5.6.100.0070.08321.09
5.6.90.0100.06320.98
5.6.80.0200.06320.51
5.6.70.0500.05320.50
5.5.350.0000.03720.40
5.5.340.0170.04017.95
5.5.330.0070.08320.35
5.5.320.0300.08020.27
5.5.310.0200.08020.31
5.5.300.0100.03318.01
5.5.290.0030.04318.08
5.5.280.0070.07320.96
5.5.270.0000.05320.77
5.5.260.0100.07720.73
5.5.250.0070.07020.48
5.5.240.0070.08320.26
5.4.450.0700.08019.33
5.4.440.0970.05319.47
5.4.430.0170.07719.52
5.4.420.0870.05719.57
5.4.410.0970.06019.43
5.4.400.0130.06319.01
5.4.390.0800.08018.97
5.4.380.0300.05318.63
5.4.370.0270.06318.53
5.4.360.0370.06018.80
5.4.350.0200.05718.70
5.4.340.0300.05318.42
5.4.320.0080.03812.51
5.4.310.0090.04112.50
5.4.300.0060.04312.50
5.4.290.0040.04512.48
5.4.280.0080.03312.38
5.4.270.0070.03612.38
5.4.260.0080.03612.38
5.4.250.0070.03812.38
5.4.240.0060.03512.38
5.4.230.0070.04012.38
5.4.220.0090.03512.38
5.4.210.0070.03512.38
5.4.200.0070.04012.37
5.4.190.0060.03612.37
5.4.180.0070.03912.37
5.4.170.0070.03712.39
5.4.160.0090.03512.38
5.4.150.0080.03312.38
5.4.140.0020.04012.06
5.4.130.0070.03612.05
5.4.120.0040.04012.00
5.4.110.0110.03312.00
5.4.100.0030.04112.00
5.4.90.0060.03812.00
5.4.80.0060.03912.00
5.4.70.0080.03412.00
5.4.60.0080.03412.00
5.4.50.0060.03811.99
5.4.40.0060.03911.99
5.4.30.0060.03511.98
5.4.20.0060.03511.98
5.4.10.0070.03811.98
5.4.00.0060.04011.47
5.3.290.0060.04112.80
5.3.280.0060.03812.71
5.3.270.0100.04112.73
5.3.260.0090.04312.72
5.3.250.0110.04912.71
5.3.240.0060.05712.72
5.3.230.0080.05412.71
5.3.220.0100.05012.68
5.3.210.0080.04512.68
5.3.200.0050.04912.68
5.3.190.0070.03812.68
5.3.180.0130.03312.67
5.3.170.0110.03312.67
5.3.160.0050.04312.67
5.3.150.0070.03912.67
5.3.140.0060.03812.66
5.3.130.0040.04212.66
5.3.120.0050.04112.66
5.3.110.0080.03912.66
5.3.100.0050.04012.13
5.3.90.0080.03512.11
5.3.80.0070.03512.10
5.3.70.0050.03912.11
5.3.60.0060.04812.08
5.3.50.0090.05012.04
5.3.40.0120.04012.04
5.3.30.0090.03412.00
5.3.20.0070.03811.78
5.3.10.0050.03611.74
5.3.00.0050.04011.73
5.2.170.0060.0319.23
5.2.160.0050.0309.23
5.2.150.0060.0329.23
5.2.140.0060.0329.23
5.2.130.0030.0339.19
5.2.120.0070.0289.19
5.2.110.0070.0389.20
5.2.100.0070.0429.19
5.2.90.0040.0389.20
5.2.80.0040.0359.19
5.2.70.0080.0299.19
5.2.60.0020.0349.14
5.2.50.0050.0309.11
5.2.40.0050.0339.09
5.2.30.0090.0309.07
5.2.20.0050.0319.04
5.2.10.0080.0318.95
5.2.00.0040.0308.82
5.1.60.0060.0238.11
5.1.50.0030.0288.10
5.1.40.0050.0308.08
5.1.30.0040.0278.43
5.1.20.0050.0268.45
5.1.10.0060.0258.18
5.1.00.0050.0288.18
5.0.50.0080.0286.66
5.0.40.0050.0296.52
5.0.30.0040.0436.32
5.0.20.0070.0196.30
5.0.10.0040.0296.27
5.0.00.0060.0336.27
4.4.90.0030.0164.78
4.4.80.0000.0204.75
4.4.70.0050.0164.75
4.4.60.0050.0164.75
4.4.50.0050.0204.77
4.4.40.0060.0264.71
4.4.30.0050.0144.76
4.4.20.0040.0164.85
4.4.10.0060.0134.85
4.4.00.0020.0284.76
4.3.110.0030.0184.67
4.3.100.0020.0174.66
4.3.90.0030.0164.63
4.3.80.0040.0294.58
4.3.70.0040.0144.63
4.3.60.0020.0164.63
4.3.50.0070.0204.63
4.3.40.0030.0344.53
4.3.30.0030.0223.30
4.3.20.0030.0213.28
4.3.10.0040.0203.24
4.3.00.0000.01310.54

preferences:
57.43 ms | 401 KiB | 5 Q