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[0] ); /* 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.00316.75
8.3.50.0240.00821.88
8.3.40.0090.00918.59
8.3.30.0140.00019.18
8.3.20.0120.00420.15
8.3.10.0040.00423.57
8.3.00.0080.00019.38
8.2.180.0160.00618.50
8.2.170.0040.01122.96
8.2.160.0130.00320.44
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00422.10
8.2.110.0030.00620.35
8.2.100.0040.00717.72
8.2.90.0060.00319.26
8.2.80.0060.00317.97
8.2.70.0030.00617.75
8.2.60.0030.00918.04
8.2.50.0030.00618.07
8.2.40.0030.00619.88
8.2.30.0070.00018.18
8.2.20.0070.00017.67
8.2.10.0040.00418.07
8.2.00.0030.00717.74
8.1.280.0190.00325.92
8.1.270.0040.00423.97
8.1.260.0000.00826.35
8.1.250.0000.00728.09
8.1.240.0100.00024.01
8.1.230.0080.00319.16
8.1.220.0030.00617.74
8.1.210.0080.00018.77
8.1.200.0000.00817.23
8.1.190.0030.00617.53
8.1.180.0030.00719.01
8.1.170.0080.00018.52
8.1.160.0040.00321.92
8.1.150.0000.01018.59
8.1.140.0000.00717.45
8.1.130.0030.00317.81
8.1.120.0050.00217.34
8.1.110.0030.00617.32
8.1.100.0000.00717.48
8.1.90.0000.00717.42
8.1.80.0070.00017.41
8.1.70.0030.00317.48
8.1.60.0060.00317.60
8.1.50.0030.00617.37
8.1.40.0080.00017.54
8.1.30.0080.00017.64
8.1.20.0050.00317.63
8.1.10.0000.00717.41
8.1.00.0030.00617.50
8.0.300.0090.00020.68
8.0.290.0000.00717.18
8.0.280.0030.00318.33
8.0.270.0040.00417.08
8.0.260.0000.00617.21
8.0.250.0000.00717.02
8.0.240.0040.00416.90
8.0.230.0000.00716.88
8.0.220.0000.00716.93
8.0.210.0040.00416.89
8.0.200.0030.00316.85
8.0.190.0000.00816.96
8.0.180.0060.00316.90
8.0.170.0040.00416.91
8.0.160.0050.00317.00
8.0.150.0000.00716.71
8.0.140.0040.00416.90
8.0.130.0090.00013.38
8.0.120.0040.00416.78
8.0.110.0050.00316.83
8.0.100.0070.00016.95
8.0.90.0000.00816.85
8.0.80.0110.00416.92
8.0.70.0030.00316.86
8.0.60.0030.00617.04
8.0.50.0050.00216.94
8.0.30.0080.01217.08
8.0.20.0080.01217.40
8.0.10.0040.00417.08
8.0.00.0030.01416.69
7.4.330.0000.00515.00
7.4.320.0000.00716.52
7.4.300.0000.00716.62
7.4.290.0040.00416.54
7.4.280.0000.00716.43
7.4.270.0000.00716.55
7.4.260.0030.00516.52
7.4.250.0070.00016.41
7.4.240.0020.00516.46
7.4.230.0030.00316.62
7.4.220.0150.00416.68
7.4.210.0090.00716.63
7.4.200.0000.00816.72
7.4.190.0000.00816.73
7.4.160.0080.00816.48
7.4.150.0090.00917.40
7.4.140.0140.00617.86
7.4.130.0080.00916.36
7.4.120.0070.01216.51
7.4.110.0000.01716.67
7.4.100.0090.00916.36
7.4.90.0080.00816.58
7.4.80.0130.01019.39
7.4.70.0030.01416.70
7.4.60.0120.00616.63
7.4.50.0000.00816.45
7.4.40.0090.00622.77
7.4.30.0030.01316.52
7.4.00.0060.00915.12
7.3.330.0060.00013.25
7.3.320.0000.00513.42
7.3.310.0000.00816.47
7.3.300.0040.00416.43
7.3.290.0070.00716.41
7.3.280.0080.00916.46
7.3.270.0090.00917.40
7.3.260.0180.01516.29
7.3.250.0080.00816.39
7.3.240.0090.00916.66
7.3.230.0100.01316.41
7.3.210.0040.01216.63
7.3.200.0080.00619.39
7.3.190.0060.01616.47
7.3.180.0100.00616.27
7.3.170.0100.00616.57
7.3.160.0100.00716.52
7.3.120.0100.00614.72
7.2.330.0100.00616.71
7.2.320.0090.00916.50
7.2.310.0060.01316.76
7.2.300.0070.01016.63
7.2.290.0130.01016.62
7.2.60.0100.00317.11
7.2.00.0030.01419.57
7.1.200.0060.00615.92
7.1.100.0040.01117.92
7.1.70.0050.00217.28
7.1.60.0150.00019.46
7.1.50.0100.01317.02
7.1.00.0070.07322.48
7.0.200.0020.00516.68
7.0.140.0030.07321.95
7.0.60.0070.05319.96
7.0.50.0030.05317.86
7.0.40.0030.04320.33
7.0.30.0300.07320.10
7.0.20.0300.04320.20
7.0.10.0100.04720.32
7.0.00.0070.08720.20
5.6.280.0030.07321.03
5.6.210.0100.06320.51
5.6.200.0030.08018.29
5.6.190.0070.04720.48
5.6.180.0130.04320.63
5.6.170.0100.05020.47
5.6.160.0070.08320.55
5.6.150.0030.04318.16
5.6.140.0100.03018.11
5.6.130.0130.07718.19
5.6.120.0070.08721.12
5.6.110.0200.07321.14
5.6.100.0100.04721.02
5.6.90.0100.03721.04
5.6.80.0100.08020.54
5.6.70.0270.07020.52
5.5.350.0000.08020.45
5.5.340.0100.04317.95
5.5.330.0000.07720.57
5.5.320.0200.03720.20
5.5.310.0330.07720.32
5.5.300.0100.03717.98
5.5.290.0070.08717.98
5.5.280.0000.05020.91
5.5.270.0070.05020.96
5.5.260.0000.06320.85
5.5.250.0100.07320.69
5.5.240.0030.07020.20
5.4.450.0800.06319.48
5.4.440.0730.05719.46
5.4.430.0900.06019.58
5.4.420.0170.05719.48
5.4.410.0030.06319.19
5.4.400.0930.05019.25
5.4.390.0970.05019.09
5.4.380.0500.06018.79
5.4.370.0370.06018.74
5.4.360.0270.06018.59
5.4.350.0370.05318.80
5.4.340.0230.06718.48
5.4.320.0090.03712.51
5.4.310.0070.04512.50
5.4.300.0060.04512.51
5.4.290.0040.04212.48
5.4.280.0060.03712.38
5.4.270.0050.03912.39
5.4.260.0090.05312.39
5.4.250.0090.04312.38
5.4.240.0040.04212.38
5.4.230.0110.03812.37
5.4.220.0050.04412.37
5.4.210.0110.03912.38
5.4.200.0050.05012.38
5.4.190.0080.04212.37
5.4.180.0040.03912.38
5.4.170.0100.03612.38
5.4.160.0080.04212.38
5.4.150.0080.04912.38
5.4.140.0070.05412.06
5.4.130.0080.04812.05
5.4.120.0040.03912.01
5.4.110.0060.04012.00
5.4.100.0040.03812.00
5.4.90.0060.04812.00
5.4.80.0070.04512.00
5.4.70.0080.04711.99
5.4.60.0050.04312.00
5.4.50.0060.04112.00
5.4.40.0060.03911.98
5.4.30.0080.03811.98
5.4.20.0100.03911.98
5.4.10.0090.03811.98
5.4.00.0060.04511.47
5.3.290.0070.04412.80
5.3.280.0120.05412.70
5.3.270.0030.04412.72
5.3.260.0090.04012.72
5.3.250.0040.04112.72
5.3.240.0090.04012.72
5.3.230.0130.03812.70
5.3.220.0100.05312.68
5.3.210.0090.05112.68
5.3.200.0070.04412.68
5.3.190.0070.04112.68
5.3.180.0090.03912.67
5.3.170.0070.03912.66
5.3.160.0100.03912.68
5.3.150.0090.04112.67
5.3.140.0090.04212.66
5.3.130.0120.06512.66
5.3.120.0090.05612.66
5.3.110.0080.05512.66
5.3.100.0060.05412.13
5.3.90.0180.04912.11
5.3.80.0050.03912.11
5.3.70.0090.03612.11
5.3.60.0080.03812.09
5.3.50.0070.04512.04
5.3.40.0050.04612.04
5.3.30.0130.04211.99
5.3.20.0100.04211.78
5.3.10.0040.04311.74
5.3.00.0080.04611.73
5.2.170.0090.0339.23
5.2.160.0080.0329.23
5.2.150.0070.0399.23
5.2.140.0070.0369.23
5.2.130.0050.0339.19
5.2.120.0120.0359.19
5.2.110.0070.0449.20
5.2.100.0090.0439.20
5.2.90.0120.0559.20
5.2.80.0030.0519.19
5.2.70.0090.0429.19
5.2.60.0080.0459.14
5.2.50.0070.0409.11
5.2.40.0070.0409.09
5.2.30.0080.0389.07
5.2.20.0060.0459.05
5.2.10.0100.0398.96
5.2.00.0080.0338.82
5.1.60.0020.0308.10
5.1.50.0050.0298.10
5.1.40.0060.0258.08
5.1.30.0060.0268.43
5.1.20.0070.0258.45
5.1.10.0040.0278.18
5.1.00.0050.0278.18
5.0.50.0050.0206.66
5.0.40.0050.0226.52
5.0.30.0040.0376.33
5.0.20.0010.0276.30
5.0.10.0020.0246.27
5.0.00.0060.0336.27
4.4.90.0040.0174.78
4.4.80.0040.0164.75
4.4.70.0040.0154.75
4.4.60.0030.0174.75
4.4.50.0020.0174.77
4.4.40.0020.0274.71
4.4.30.0030.0174.76
4.4.20.0020.0174.84
4.4.10.0050.0154.85
4.4.00.0050.0324.76
4.3.110.0010.0264.67
4.3.100.0050.0174.66
4.3.90.0040.0154.64
4.3.80.0020.0254.58
4.3.70.0040.0134.63
4.3.60.0020.0174.63
4.3.50.0030.0154.63
4.3.40.0060.0214.54
4.3.30.0010.0183.30
4.3.20.0030.0183.28
4.3.10.0010.0233.23
4.3.00.0300.01710.54

preferences:
44.67 ms | 401 KiB | 5 Q