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]; $blah= array(); $blah[($first_key[$first_key])] = 'dobee'; $test->__set($array[$first_key] , $blah[$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.60.0060.00916.63
8.3.50.0140.00521.98
8.3.40.0050.01518.54
8.3.30.0120.00319.14
8.3.20.0000.01419.94
8.3.10.0090.00023.65
8.3.00.0050.00319.25
8.2.180.0160.00318.50
8.2.170.0140.00722.96
8.2.160.0100.00720.52
8.2.150.0070.00024.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00422.20
8.2.110.0060.00322.20
8.2.100.0060.00617.80
8.2.90.0040.00419.28
8.2.80.0000.00818.04
8.2.70.0030.00617.63
8.2.60.0030.00517.93
8.2.50.0040.00818.07
8.2.40.0040.00419.88
8.2.30.0050.00517.99
8.2.20.0070.00017.62
8.2.10.0050.00318.11
8.2.00.0030.00617.71
8.1.280.0130.00925.92
8.1.270.0100.01021.99
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0030.00623.87
8.1.230.0110.00019.20
8.1.220.0000.00817.74
8.1.210.0130.00018.77
8.1.200.0000.00917.35
8.1.190.0040.00417.53
8.1.180.0030.00518.10
8.1.170.0060.00318.58
8.1.160.0000.00721.97
8.1.150.0100.00018.59
8.1.140.0040.00417.41
8.1.130.0000.00717.80
8.1.120.0030.00517.27
8.1.110.0040.00717.38
8.1.100.0040.00417.41
8.1.90.0050.00217.44
8.1.80.0030.00317.41
8.1.70.0030.00317.39
8.1.60.0000.00917.60
8.1.50.0080.00017.52
8.1.40.0000.00817.56
8.1.30.0000.00817.57
8.1.20.0040.00417.64
8.1.10.0080.00017.52
8.1.00.0000.00717.52
8.0.300.0000.00719.00
8.0.290.0040.00416.93
8.0.280.0080.00018.32
8.0.270.0030.00317.25
8.0.260.0000.00617.26
8.0.250.0000.00716.99
8.0.240.0070.00017.02
8.0.230.0030.00317.02
8.0.220.0000.00716.81
8.0.210.0050.00316.83
8.0.200.0060.00016.84
8.0.190.0000.00716.95
8.0.180.0000.00716.97
8.0.170.0000.00716.85
8.0.160.0040.00416.86
8.0.150.0000.00716.88
8.0.140.0000.00816.77
8.0.130.0040.00413.28
8.0.120.0040.00416.83
8.0.110.0070.00016.84
8.0.100.0000.00716.93
8.0.90.0030.00516.87
8.0.80.0090.00916.96
8.0.70.0000.00717.03
8.0.60.0030.00716.78
8.0.50.0000.00716.78
8.0.30.0090.01017.07
8.0.20.0140.00417.40
8.0.10.0030.00517.04
8.0.00.0070.01016.84
7.4.330.0000.00515.00
7.4.320.0030.00316.54
7.4.300.0060.00016.56
7.4.290.0070.00016.45
7.4.280.0000.00716.66
7.4.270.0000.00716.43
7.4.260.0000.00816.58
7.4.250.0050.00216.56
7.4.240.0040.00316.56
7.4.230.0030.00316.32
7.4.220.0080.00916.51
7.4.210.0050.01116.58
7.4.200.0050.00216.72
7.4.190.0000.00716.62
7.4.160.0100.01316.42
7.4.150.0030.01517.40
7.4.140.0110.00617.86
7.4.130.0090.00916.60
7.4.120.0040.01416.55
7.4.110.0070.01016.34
7.4.100.0060.01316.63
7.4.90.0070.01016.39
7.4.80.0090.00919.39
7.4.70.0070.01716.59
7.4.60.0130.00716.34
7.4.50.0000.00916.57
7.4.40.0040.01122.77
7.4.30.0120.01116.58
7.4.00.0100.00714.91
7.3.330.0070.00013.44
7.3.320.0050.00013.43
7.3.310.0040.00416.39
7.3.300.0060.00316.44
7.3.290.0040.00916.42
7.3.280.0090.00716.42
7.3.270.0120.00617.40
7.3.260.0120.00616.52
7.3.250.0120.00416.36
7.3.240.0100.00716.54
7.3.230.0100.01016.39
7.3.210.0070.01516.45
7.3.200.0040.01719.39
7.3.190.0120.00616.38
7.3.180.0120.00316.37
7.3.170.0070.01316.45
7.3.160.0140.00316.41
7.3.120.0140.00314.68
7.2.330.0120.00616.83
7.2.320.0030.01316.46
7.2.310.0120.00616.84
7.2.300.0080.00816.82
7.2.290.0030.01316.80
7.2.60.0060.00916.68
7.2.00.0070.00719.50
7.1.200.0060.00615.98
7.1.100.0040.00817.80
7.1.70.0000.00917.22
7.1.60.0070.00719.46
7.1.50.0090.01217.09
7.1.00.0000.08022.32
7.0.200.0060.00316.56
7.0.140.0030.07321.99
7.0.60.0100.08319.96
7.0.50.0030.04317.87
7.0.40.0070.05720.18
7.0.30.0500.05720.21
7.0.20.0370.07020.20
7.0.10.0070.09020.19
7.0.00.0030.04320.20
5.6.280.0030.07321.05
5.6.210.0000.06720.61
5.6.200.0130.04018.25
5.6.190.0100.09020.61
5.6.180.3830.03720.77
5.6.170.0270.03720.57
5.6.160.0100.08020.48
5.6.150.0030.04718.18
5.6.140.0000.09018.28
5.6.130.0030.08718.15
5.6.120.0170.06721.06
5.6.110.0100.05721.04
5.6.100.0070.04021.01
5.6.90.0030.04021.01
5.6.80.0070.08020.52
5.6.70.3900.04020.36
5.5.350.0030.08020.39
5.5.340.0030.04018.08
5.5.330.0070.08720.27
5.5.320.0170.03720.42
5.5.310.0370.07720.19
5.5.300.0070.07018.09
5.5.290.0030.08318.05
5.5.280.0070.08320.65
5.5.270.0000.09020.90
5.5.260.0130.07020.94
5.5.250.0100.03320.69
5.5.240.0030.07320.25
5.4.450.0570.04719.19
5.4.440.0900.03019.52
5.4.430.0500.04019.57
5.4.420.1070.04319.54
5.4.410.0570.03319.18
5.4.400.0400.02718.95
5.4.390.0270.05318.87
5.4.380.0400.07018.83
5.4.370.0230.06018.63
5.4.360.0370.05318.50
5.4.350.0300.05718.48
5.4.340.0470.06718.76
5.4.320.0070.03612.51
5.4.310.0070.04312.50
5.4.300.0080.04012.51
5.4.290.0060.04012.49
5.4.280.0070.03712.39
5.4.270.0130.04212.39
5.4.260.0100.03612.39
5.4.250.0120.04912.39
5.4.240.0060.05912.39
5.4.230.0070.05012.38
5.4.220.0060.04212.38
5.4.210.0100.05012.38
5.4.200.0100.05512.38
5.4.190.0070.05112.37
5.4.180.0100.05112.38
5.4.170.0100.05612.38
5.4.160.0050.05012.38
5.4.150.0100.03812.37
5.4.140.0110.05212.06
5.4.130.0090.04712.05
5.4.120.0090.04112.00
5.4.110.0090.05512.00
5.4.100.0120.04612.00
5.4.90.0110.05012.00
5.4.80.0130.06112.00
5.4.70.0110.04712.00
5.4.60.0080.04712.00
5.4.50.0090.04712.00
5.4.40.0120.03111.99
5.4.30.0050.04011.98
5.4.20.0070.03611.98
5.4.10.0070.03511.98
5.4.00.0080.03511.48
5.3.290.0070.04712.80
5.3.280.0080.03812.70
5.3.270.0070.04312.72
5.3.260.0060.03912.72
5.3.250.0090.03612.71
5.3.240.0050.04012.72
5.3.230.0040.04112.71
5.3.220.0080.03712.68
5.3.210.0060.04012.68
5.3.200.0060.04212.68
5.3.190.0110.05612.67
5.3.180.0080.04412.68
5.3.170.0040.03812.67
5.3.160.0050.03712.68
5.3.150.0060.03712.67
5.3.140.0060.03912.66
5.3.130.0080.03712.66
5.3.120.0090.03712.66
5.3.110.0090.04212.66
5.3.100.0070.04012.13
5.3.90.0060.03812.11
5.3.80.0070.03812.11
5.3.70.0080.03812.10
5.3.60.0050.03712.09
5.3.50.0080.03512.04
5.3.40.0080.03612.04
5.3.30.0080.03811.99
5.3.20.0070.03411.77
5.3.10.0090.03311.74
5.3.00.0060.03811.73
5.2.170.0070.0309.24
5.2.160.0080.0299.24
5.2.150.0070.0309.24
5.2.140.0060.0309.23
5.2.130.0050.0309.20
5.2.120.0060.0429.20
5.2.110.0060.0419.20
5.2.100.0080.0409.19
5.2.90.0060.0329.19
5.2.80.0050.0329.19
5.2.70.0060.0319.19
5.2.60.0060.0309.14
5.2.50.0040.0349.11
5.2.40.0050.0299.09
5.2.30.0060.0319.07
5.2.20.0080.0269.05
5.2.10.0060.0308.96
5.2.00.0060.0328.82
5.1.60.0050.0258.11
5.1.50.0030.0268.10
5.1.40.0020.0278.08
5.1.30.0030.0288.43
5.1.20.0020.0298.45
5.1.10.0100.0258.18
5.1.00.0110.0328.18
5.0.50.0040.0216.66
5.0.40.0050.0186.52
5.0.30.0060.0296.32
5.0.20.0060.0186.30
5.0.10.0030.0216.27
5.0.00.0040.0306.27
4.4.90.0000.0184.78
4.4.80.0020.0164.76
4.4.70.0010.0174.76
4.4.60.0010.0184.76
4.4.50.0030.0174.77
4.4.40.0060.0324.71
4.4.30.0030.0154.76
4.4.20.0020.0164.84
4.4.10.0040.0144.85
4.4.00.0030.0254.76
4.3.110.0040.0144.67
4.3.100.0020.0164.67
4.3.90.0030.0154.64
4.3.80.0040.0244.58
4.3.70.0050.0134.63
4.3.60.0030.0154.63
4.3.50.0030.0164.63
4.3.40.0030.0254.54
4.3.30.0020.0163.30
4.3.20.0020.0163.28
4.3.10.0040.0173.23
4.3.00.0170.03713.47

preferences:
40.55 ms | 401 KiB | 5 Q