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[0] = 'blah'; $blah = $v[($v[0])]; $blah[0] = 'blah'; $test->__set($array[$first_key] , $blah[0]['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.0070.01117.00
8.3.50.0120.00622.00
8.3.40.0100.00718.88
8.3.30.0060.00818.87
8.3.20.0040.01120.30
8.3.10.0040.00423.64
8.3.00.0080.00019.51
8.2.180.0040.01518.54
8.2.170.0100.00722.96
8.2.160.0130.00020.35
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0060.00322.19
8.2.110.0090.00020.95
8.2.100.0140.00017.91
8.2.90.0030.00619.07
8.2.80.0040.00417.97
8.2.70.0060.00317.75
8.2.60.0000.00817.80
8.2.50.0000.00818.10
8.2.40.0000.00820.42
8.2.30.0000.00718.08
8.2.20.0030.00517.64
8.2.10.0040.00417.97
8.2.00.0060.00317.68
8.1.280.0150.00625.92
8.1.270.0060.00322.07
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0060.00321.12
8.1.230.0040.00719.20
8.1.220.0030.00617.78
8.1.210.0000.00818.77
8.1.200.0030.00617.35
8.1.190.0050.00517.13
8.1.180.0040.00418.10
8.1.170.0030.00518.71
8.1.160.0000.00818.83
8.1.150.0040.00418.50
8.1.140.0040.00417.40
8.1.130.0030.00317.85
8.1.120.0030.00417.46
8.1.110.0030.00617.33
8.1.100.0030.00517.39
8.1.90.0050.00317.30
8.1.80.0030.00317.42
8.1.70.0040.00417.33
8.1.60.0030.00617.59
8.1.50.0080.00017.52
8.1.40.0040.00417.45
8.1.30.0040.00417.64
8.1.20.0000.00817.63
8.1.10.0020.00517.57
8.1.00.0030.00617.38
8.0.300.0060.00318.77
8.0.290.0050.00216.75
8.0.280.0030.00318.35
8.0.270.0000.00717.20
8.0.260.0070.00017.13
8.0.250.0070.00016.87
8.0.240.0060.00316.97
8.0.230.0030.00316.95
8.0.220.0070.00016.95
8.0.210.0000.00916.90
8.0.200.0000.00616.85
8.0.190.0000.00717.02
8.0.180.0040.00416.90
8.0.170.0040.00416.95
8.0.160.0040.00416.79
8.0.150.0030.00516.91
8.0.140.0070.00016.83
8.0.130.0060.00013.29
8.0.120.0040.00416.95
8.0.110.0050.00316.93
8.0.100.0000.00716.85
8.0.90.0050.00216.80
8.0.80.0120.00616.80
8.0.70.0030.00316.78
8.0.60.0080.00016.97
8.0.50.0030.00316.77
8.0.30.0100.00917.13
8.0.20.0080.01017.40
8.0.10.0040.00416.93
8.0.00.0090.00816.72
7.4.330.0000.00515.00
7.4.320.0040.00416.44
7.4.300.0060.00016.50
7.4.290.0000.00816.62
7.4.280.0030.00316.53
7.4.270.0040.00316.63
7.4.260.0050.00316.48
7.4.250.0060.00216.48
7.4.240.0010.00616.64
7.4.230.0030.00316.68
7.4.220.0030.01916.53
7.4.210.0080.01016.52
7.4.200.0000.00716.72
7.4.190.0030.00316.48
7.4.160.0080.01516.39
7.4.150.0120.00617.40
7.4.140.0130.00517.86
7.4.130.0090.00616.71
7.4.120.0050.01116.50
7.4.110.0060.01216.43
7.4.100.0120.00616.64
7.4.90.0140.00716.50
7.4.80.0140.01119.39
7.4.70.0170.00716.75
7.4.60.0120.00616.45
7.4.50.0090.00016.49
7.4.40.0100.00722.77
7.4.30.0150.00316.29
7.4.00.0060.00614.98
7.3.330.0030.00313.43
7.3.320.0030.00313.38
7.3.310.0030.00316.27
7.3.300.0030.00616.43
7.3.290.0100.00416.43
7.3.280.0070.00816.43
7.3.270.0040.01517.40
7.3.260.0070.01016.68
7.3.250.0120.00616.64
7.3.240.0120.00616.52
7.3.230.0110.00616.46
7.3.210.0090.00916.44
7.3.200.0120.01219.39
7.3.190.0070.01016.39
7.3.180.0110.00916.56
7.3.170.0070.01016.30
7.3.160.0070.01016.54
7.3.120.0030.01314.80
7.3.110.0030.01414.63
7.3.100.0030.01214.73
7.3.90.0070.00714.70
7.3.80.0070.00714.82
7.3.70.0060.00614.63
7.3.60.0060.00914.89
7.3.50.0090.00614.39
7.3.40.0000.01114.83
7.3.30.0030.00614.68
7.3.20.0000.01316.73
7.3.10.0120.00316.58
7.3.00.0030.00916.39
7.2.330.0090.00916.85
7.2.320.0090.00916.80
7.2.310.0080.01516.88
7.2.300.0120.00716.82
7.2.290.0110.01116.48
7.2.240.0090.00615.03
7.2.230.0030.01215.00
7.2.220.0030.01215.03
7.2.210.0000.01715.12
7.2.200.0100.00615.24
7.2.190.0090.00615.23
7.2.180.0030.01415.29
7.2.170.0070.00715.24
7.2.160.0070.01114.93
7.2.150.0120.00316.93
7.2.140.0080.00816.76
7.2.130.0000.01616.98
7.2.120.0070.01017.04
7.2.110.0150.00316.46
7.2.100.0080.00316.63
7.2.90.0030.01017.05
7.2.80.0060.00916.68
7.2.70.0090.00616.98
7.2.60.0110.00516.94
7.2.50.0110.00716.95
7.2.40.0000.01516.82
7.2.30.0070.01016.95
7.2.20.0070.01017.03
7.2.10.0080.00416.91
7.2.00.0020.01118.11
7.1.330.0040.01215.75
7.1.320.0000.01415.72
7.1.310.0090.00615.76
7.1.300.0080.00415.77
7.1.290.0160.00015.69
7.1.280.0040.01215.88
7.1.270.0100.00715.66
7.1.260.0040.01115.88
7.1.250.0030.00915.56
7.1.200.0040.00715.80
7.1.100.0090.00918.25
7.1.70.0000.00717.14
7.1.60.0040.00819.46
7.1.50.0070.01717.09
7.1.00.0100.07022.45
7.0.200.0050.00216.79
7.0.140.0070.07022.07
7.0.60.0000.04719.80
7.0.50.0070.08017.91
7.0.40.0070.04019.97
7.0.30.0470.04320.24
7.0.20.0270.07720.22
7.0.10.0070.06020.23
7.0.00.0070.04320.26
5.6.280.0070.07020.79
5.6.210.0100.03320.47
5.6.200.0030.05018.31
5.6.190.0130.06020.55
5.6.180.3430.04320.33
5.6.170.0230.07320.52
5.6.160.0000.04720.54
5.6.150.0030.08318.12
5.6.140.0100.05718.18
5.6.130.0100.06318.18
5.6.120.0030.06020.99
5.6.110.0070.05720.98
5.6.100.0130.07321.01
5.6.90.0130.08020.87
5.6.80.0230.06720.54
5.6.70.4430.03720.50
5.5.350.0370.07320.43
5.5.340.0070.03717.98
5.5.330.0070.04020.40
5.5.320.0230.08320.27
5.5.310.0300.07320.36
5.5.300.0130.04017.98
5.5.290.0030.09017.98
5.5.280.0030.08720.77
5.5.270.0000.06020.97
5.5.260.0070.08720.88
5.5.250.0000.04320.62
5.5.240.0230.06720.35
5.4.450.0200.06719.61
5.4.440.0270.06319.63
5.4.430.0070.05719.65
5.4.420.0130.05019.36
5.4.410.0130.05019.58
5.4.400.0070.06319.09
5.4.390.0200.05019.12
5.4.380.0500.06718.71
5.4.370.0330.07718.53
5.4.360.0330.07318.63
5.4.350.0400.06718.86
5.4.340.0370.05318.50
5.4.320.0050.04212.51
5.4.310.0050.03812.50
5.4.300.0070.04612.51
5.4.290.0060.04112.48
5.4.280.0130.03812.38
5.4.270.0080.04212.38
5.4.260.0130.03612.38
5.4.250.0050.04212.38
5.4.240.0090.03912.38
5.4.230.0060.04212.38
5.4.220.0140.03812.37
5.4.210.0060.04412.38
5.4.200.0130.03812.38
5.4.190.0090.04212.38
5.4.180.0070.04012.37
5.4.170.0080.03712.38
5.4.160.0090.03512.38
5.4.150.0070.03812.38
5.4.140.0100.03512.06
5.4.130.0050.03812.05
5.4.120.0060.04112.01
5.4.110.0090.03712.00
5.4.100.0040.03912.00
5.4.90.0050.04112.00
5.4.80.0060.03912.00
5.4.70.0020.04112.00
5.4.60.0080.03612.00
5.4.50.0070.03612.00
5.4.40.0040.05411.98
5.4.30.0060.03811.98
5.4.20.0060.03711.98
5.4.10.0060.05211.98
5.4.00.0060.03711.48
5.3.290.0090.04512.80
5.3.280.0090.04012.71
5.3.270.0070.04712.73
5.3.260.0070.04412.71
5.3.250.0090.04812.72
5.3.240.0090.05512.72
5.3.230.0130.04012.71
5.3.220.0070.04412.68
5.3.210.0050.04712.68
5.3.200.0120.05012.68
5.3.190.0110.03912.68
5.3.180.0130.05312.67
5.3.170.0020.05912.67
5.3.160.0030.04312.68
5.3.150.0080.03612.67
5.3.140.0040.04112.66
5.3.130.0070.04012.65
5.3.120.0100.03812.66
5.3.110.0090.03912.65
5.3.100.0100.03612.13
5.3.90.0060.03812.11
5.3.80.0060.03812.11
5.3.70.0050.03912.10
5.3.60.0040.04112.09
5.3.50.0090.03612.04
5.3.40.0090.04912.04
5.3.30.0080.04312.00
5.3.20.0040.04111.77
5.3.10.0090.03611.74
5.3.00.0070.04911.73
5.2.170.0080.0309.23
5.2.160.0060.0289.23
5.2.150.0100.0289.23
5.2.140.0030.0339.23
5.2.130.0090.0299.19
5.2.120.0030.0309.19
5.2.110.0040.0339.20
5.2.100.0030.0329.19
5.2.90.0080.0289.19
5.2.80.0060.0439.19
5.2.70.0050.0349.19
5.2.60.0100.0449.14
5.2.50.0030.0469.11
5.2.40.0100.0459.09
5.2.30.0080.0489.07
5.2.20.0070.0449.05
5.2.10.0080.0418.96
5.2.00.0110.0388.82
5.1.60.0110.0308.10
5.1.50.0050.0408.10
5.1.40.0070.0358.08
5.1.30.0060.0288.43
5.1.20.0040.0298.45
5.1.10.0030.0298.18
5.1.00.0030.0308.18
5.0.50.0040.0226.65
5.0.40.0030.0226.52
5.0.30.0070.0406.33
5.0.20.0070.0246.29
5.0.10.0070.0206.28
5.0.00.0040.0326.27
4.4.90.0070.0154.78
4.4.80.0070.0284.75
4.4.70.0070.0234.76
4.4.60.0040.0214.75
4.4.50.0020.0184.77
4.4.40.0030.0284.71
4.4.30.0000.0204.76
4.4.20.0010.0184.84
4.4.10.0050.0154.85
4.4.00.0050.0234.75
4.3.110.0030.0164.67
4.3.100.0040.0164.67
4.3.90.0070.0204.63
4.3.80.0050.0324.59
4.3.70.0020.0234.63
4.3.60.0020.0234.63
4.3.50.0040.0174.63
4.3.40.0020.0274.54
4.3.30.0030.0193.30
4.3.20.0040.0153.28
4.3.10.0020.0183.23
4.3.00.0030.0236.92

preferences:
51.43 ms | 401 KiB | 5 Q