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; public $testy; 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; print_r($test);die(); // start editing here class Intercept { public function getKey($test) { $array = (array) $test; reset($array); $first_key = key($array); print_r($array[$first_key]); $blah = array(); $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.70.0110.00418.30
8.3.60.0110.00416.50
8.3.50.0060.01122.02
8.3.40.0120.00318.61
8.3.30.0070.00719.07
8.3.20.0090.00620.34
8.3.10.0000.00723.54
8.3.00.0040.00419.26
8.2.180.0040.01818.18
8.2.170.0070.00722.96
8.2.160.0100.00320.38
8.2.150.0080.00024.18
8.2.140.0100.00324.66
8.2.130.0040.00426.16
8.2.120.0030.00522.08
8.2.110.0190.00420.57
8.2.100.0040.00817.91
8.2.90.0080.00019.10
8.2.80.0040.00417.97
8.2.70.0030.00517.50
8.2.60.0000.00817.80
8.2.50.0000.00818.07
8.2.40.0040.00419.94
8.2.30.0040.00418.10
8.2.20.0030.00617.82
8.2.10.0040.00418.02
8.2.00.0030.00617.62
8.1.280.0100.00725.92
8.1.270.0060.00322.25
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0060.00319.22
8.1.230.0030.00719.16
8.1.220.0030.00617.74
8.1.210.0040.00418.77
8.1.200.0030.00617.35
8.1.190.0080.00017.53
8.1.180.0080.00318.10
8.1.170.0030.00618.21
8.1.160.0040.00421.89
8.1.150.0000.00718.68
8.1.140.0040.00417.42
8.1.130.0050.00317.90
8.1.120.0040.00317.33
8.1.110.0000.01117.23
8.1.100.0000.00717.33
8.1.90.0070.00017.31
8.1.80.0030.00317.35
8.1.70.0070.00017.35
8.1.60.0030.00617.39
8.1.50.0040.00417.55
8.1.40.0040.00417.60
8.1.30.0000.00817.66
8.1.20.0080.00017.72
8.1.10.0040.00417.61
8.1.00.0040.00417.50
8.0.300.0040.00418.77
8.0.290.0000.00717.05
8.0.280.0000.00718.32
8.0.270.0030.00317.23
8.0.260.0040.00417.14
8.0.250.0080.00016.99
8.0.240.0040.00416.96
8.0.230.0040.00416.92
8.0.220.0030.00316.94
8.0.210.0030.00316.95
8.0.200.0000.00716.87
8.0.190.0080.00016.95
8.0.180.0000.00716.94
8.0.170.0000.00816.91
8.0.160.0000.00716.94
8.0.150.0040.00416.97
8.0.140.0040.00416.90
8.0.130.0050.00013.30
8.0.120.0050.00316.86
8.0.110.0030.00616.83
8.0.100.0000.00716.77
8.0.90.0000.00716.91
8.0.80.0070.01016.80
8.0.70.0000.00816.83
8.0.60.0030.00616.81
8.0.50.0040.00416.92
8.0.30.0080.01217.08
8.0.20.0100.00817.40
8.0.10.0040.00416.93
8.0.00.0110.00616.69
7.4.330.0020.00215.00
7.4.320.0000.00616.46
7.4.300.0000.00716.41
7.4.290.0040.00416.48
7.4.280.0050.00216.60
7.4.270.0070.00016.42
7.4.260.0000.00716.47
7.4.250.0000.00916.36
7.4.240.0020.00616.58
7.4.230.0070.00016.56
7.4.220.0030.01416.51
7.4.210.0030.01216.49
7.4.200.0000.00716.27
7.4.190.0070.00016.63
7.4.160.0130.00316.46
7.4.150.0110.00617.40
7.4.140.0100.00717.86
7.4.130.0110.00616.43
7.4.120.0110.01116.52
7.4.110.0070.01016.62
7.4.100.0090.00916.60
7.4.90.0070.01016.66
7.4.80.0110.00719.39
7.4.70.0090.00916.50
7.4.60.0130.00316.48
7.4.50.0000.00816.08
7.4.40.0040.01522.77
7.4.30.0030.01316.38
7.4.00.0070.01114.76
7.3.330.0030.00513.08
7.3.320.0030.00313.20
7.3.310.0000.00716.13
7.3.300.0040.00416.12
7.3.290.0060.00716.22
7.3.280.0100.00816.24
7.3.270.0060.01217.40
7.3.260.0110.00716.55
7.3.250.0110.01016.52
7.3.240.0090.00816.28
7.3.230.0150.00616.39
7.3.210.0070.01616.43
7.3.200.0090.00919.39
7.3.190.0060.01116.29
7.3.180.0090.00616.19
7.3.170.0070.00816.39
7.3.160.0100.00716.19
7.3.120.0070.01014.34
7.3.110.0090.00614.75
7.3.100.0030.00914.63
7.3.90.0060.00614.46
7.3.80.0030.00914.75
7.3.70.0100.00714.70
7.3.60.0070.00714.76
7.3.50.0000.02014.70
7.3.40.0040.01314.73
7.3.30.0060.01014.65
7.3.20.0030.00816.42
7.3.10.0060.00916.45
7.3.00.0060.00916.29
7.2.330.0060.01016.60
7.2.320.0080.01616.61
7.2.310.0040.01816.57
7.2.300.0150.00316.59
7.2.290.0100.00616.54
7.2.240.0040.01415.13
7.2.230.0070.00714.68
7.2.220.0030.00714.67
7.2.210.0000.01114.79
7.2.200.0060.00614.82
7.2.190.0080.01214.63
7.2.180.0080.01514.79
7.2.170.0040.01314.82
7.2.160.0000.01114.66
7.2.150.0100.00716.50
7.2.140.0070.00716.75
7.2.130.0000.01116.73
7.2.120.0090.00616.66
7.2.110.0120.00616.81
7.2.100.0070.00316.45
7.2.90.0150.00416.58
7.2.80.0110.00416.68
7.2.70.0060.00916.69
7.2.60.0030.01016.52
7.2.50.0070.00316.48
7.2.40.0100.00316.83
7.2.30.0050.00816.92
7.2.20.0060.00916.57
7.2.10.0040.01116.91
7.2.00.0060.00818.08
7.1.330.0040.01115.65
7.1.320.0040.01115.73
7.1.310.0100.00315.38
7.1.300.0120.00615.56
7.1.290.0100.01015.59
7.1.280.0070.01315.32
7.1.270.0110.00315.68
7.1.260.0000.01115.51
7.1.250.0040.01115.91
7.1.100.0160.00918.20
7.1.70.0050.00217.06
7.1.60.0070.00719.46
7.1.50.0000.01216.89
7.1.00.0070.07322.41
7.0.200.0000.00816.79
7.0.140.0000.07721.95
7.0.60.0070.04019.93
7.0.50.0070.05017.90
7.0.40.0100.08720.15
7.0.30.0330.04720.06
7.0.20.0330.06720.20
7.0.10.0100.03720.16
7.0.00.0130.04320.25
5.6.280.0000.07720.89
5.6.210.0100.05720.75
5.6.200.0030.05018.18
5.6.190.0070.05720.61
5.6.180.0230.03720.48
5.6.170.0130.04320.44
5.6.160.0130.07320.62
5.6.150.0070.05318.27
5.6.140.0030.07718.19
5.6.130.0000.05018.23
5.6.120.0070.07721.02
5.6.110.0100.05320.98
5.6.100.0100.07021.01
5.6.90.0070.09021.06
5.6.80.0170.06320.44
5.6.70.4600.04020.38
5.5.350.0130.06020.53
5.5.340.0070.04017.96
5.5.330.0130.06720.40
5.5.320.0370.04720.38
5.5.310.0370.07720.25
5.5.300.0000.04318.01
5.5.290.0070.08717.98
5.5.280.0130.04720.78
5.5.270.0100.08320.77
5.5.260.0030.06720.80
5.5.250.0030.09020.70
5.5.240.0200.05720.16
5.4.450.0670.05319.66
5.4.440.0630.08719.16
5.4.430.0400.07719.56
5.4.420.0630.06319.66
5.4.410.0930.07319.20
5.4.400.0100.05019.22
5.4.390.0530.05319.24
5.4.380.0300.05318.75
5.4.370.0330.06318.47
5.4.360.0230.06018.89
5.4.350.0400.04718.79
5.4.340.0400.05718.61
5.4.320.0060.03612.51
5.4.310.0050.04512.50
5.4.300.0090.03912.50
5.4.290.0090.05212.49
5.4.280.0140.06012.38
5.4.270.0070.06412.38
5.4.260.0070.04112.39
5.4.250.0090.03812.38
5.4.240.0200.04512.38
5.4.230.0090.05412.38
5.4.220.0080.04412.38
5.4.210.0180.05112.38
5.4.200.0120.06512.38
5.4.190.0140.07912.37
5.4.180.0070.07612.37
5.4.170.0090.05212.38
5.4.160.0150.06012.38
5.4.150.0190.04612.38
5.4.140.0120.05212.05
5.4.130.0150.06412.04
5.4.120.0130.06612.00
5.4.110.0090.05412.00
5.4.100.0120.06312.00
5.4.90.0150.07612.00
5.4.80.0130.03912.00
5.4.70.0110.03412.00
5.4.60.0100.03812.00
5.4.50.0080.03812.00
5.4.40.0080.03911.98
5.4.30.0110.04111.98
5.4.20.0070.04811.98
5.4.10.0200.09211.98
5.4.00.0120.06611.47
5.3.290.0070.04812.80
5.3.280.0190.09812.70
5.3.270.0080.05112.73
5.3.260.0140.05712.72
5.3.250.0050.04312.72
5.3.240.0050.04712.72
5.3.230.0050.04512.71
5.3.220.0080.04312.68
5.3.210.0100.06312.68
5.3.200.0120.04612.68
5.3.190.0090.05412.68
5.3.180.0170.08212.68
5.3.170.0090.04412.67
5.3.160.0210.10212.67
5.3.150.0110.05912.67
5.3.140.0180.08312.66
5.3.130.0100.08312.65
5.3.120.0150.08712.66
5.3.110.0230.09212.66
5.3.100.0100.07612.13
5.3.90.0150.05112.11
5.3.80.0120.04812.10
5.3.70.0160.05912.10
5.3.60.0160.04112.09
5.3.50.0070.04812.04
5.3.40.0090.06412.04
5.3.30.0100.06012.00
5.3.20.0140.05811.78
5.3.10.0140.05811.74
5.3.00.0130.04211.73
5.2.170.0060.0439.23
5.2.160.0140.0479.23
5.2.150.0080.0449.23
5.2.140.0060.0429.23
5.2.130.0090.0329.19
5.2.120.0090.0289.19
5.2.110.0050.0349.20
5.2.100.0030.0329.20
5.2.90.0090.0289.20
5.2.80.0080.0369.19
5.2.70.0070.0339.19
5.2.60.0040.0339.14
5.2.50.0050.0329.11
5.2.40.0060.0299.09
5.2.30.0080.0309.06
5.2.20.0050.0309.05
5.2.10.0040.0318.95
5.2.00.0070.0308.82
5.1.60.0050.0268.11
5.1.50.0090.0348.10
5.1.40.0050.0368.08
5.1.30.0080.0358.43
5.1.20.0060.0378.45
5.1.10.0100.0398.18
5.1.00.0050.0308.18
5.0.50.0080.0356.66
5.0.40.0090.0256.52
5.0.30.0110.0366.32
5.0.20.0020.0306.29
5.0.10.0070.0246.28
5.0.00.0040.0426.27
4.4.90.0080.0214.78
4.4.80.0050.0214.75
4.4.70.0040.0194.75
4.4.60.0070.0154.76
4.4.50.0040.0204.77
4.4.40.0030.0314.71
4.4.30.0050.0184.76
4.4.20.0050.0284.85
4.4.10.0070.0284.85
4.4.00.0090.0314.76
4.3.110.0060.0184.67
4.3.100.0110.0294.66
4.3.90.0070.0224.63
4.3.80.0060.0284.59
4.3.70.0090.0224.63
4.3.60.0030.0264.63
4.3.50.0030.0224.63
4.3.40.0070.0394.54
4.3.30.0020.0213.30
4.3.20.0030.0203.28
4.3.10.0030.0193.23
4.3.00.0170.01710.54

preferences:
38.06 ms | 401 KiB | 5 Q