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; // 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(); print_r($test);die();

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.0000.01616.88
8.3.50.0160.00321.95
8.3.40.0180.00018.98
8.3.30.0110.00319.12
8.3.20.0070.00720.21
8.3.10.0040.00423.46
8.3.00.0000.00819.38
8.2.180.0100.01318.29
8.2.170.0090.00622.96
8.2.160.0100.00720.29
8.2.150.0050.00324.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00421.88
8.2.110.0030.00622.08
8.2.100.0000.01117.84
8.2.90.0090.00019.21
8.2.80.0040.00417.97
8.2.70.0040.00417.50
8.2.60.0050.00317.93
8.2.50.0050.00318.07
8.2.40.0050.00319.77
8.2.30.0000.00818.00
8.2.20.0000.00817.71
8.2.10.0040.00418.15
8.2.00.0030.00517.65
8.1.280.0150.00325.92
8.1.270.0100.01022.14
8.1.260.0050.00526.35
8.1.250.0080.00028.09
8.1.240.0100.00023.96
8.1.230.0080.00419.21
8.1.220.0080.00017.79
8.1.210.0000.00818.77
8.1.200.0070.00317.23
8.1.190.0040.00417.30
8.1.180.0030.00618.10
8.1.170.0060.00318.61
8.1.160.0050.00221.89
8.1.150.0060.00318.52
8.1.140.0040.00417.46
8.1.130.0000.00717.86
8.1.120.0070.00017.28
8.1.110.0000.01017.38
8.1.100.0040.00417.42
8.1.90.0000.00717.42
8.1.80.0000.00717.32
8.1.70.0000.00717.43
8.1.60.0000.00717.45
8.1.50.0000.00817.49
8.1.40.0000.00817.43
8.1.30.0080.00017.60
8.1.20.0000.00917.70
8.1.10.0040.00417.59
8.1.00.0060.00317.45
8.0.300.0040.00418.77
8.0.290.0050.00317.04
8.0.280.0070.00018.45
8.0.270.0000.00816.85
8.0.260.0000.00817.14
8.0.250.0000.00716.89
8.0.240.0030.00316.98
8.0.230.0000.00816.96
8.0.220.0040.00416.93
8.0.210.0050.00516.93
8.0.200.0000.00616.97
8.0.190.0050.00316.98
8.0.180.0050.00216.95
8.0.170.0000.00816.93
8.0.160.0050.00316.81
8.0.150.0000.00816.91
8.0.140.0000.00816.84
8.0.130.0030.00613.41
8.0.120.0050.00316.85
8.0.110.0040.00416.97
8.0.100.0050.00316.98
8.0.90.0000.00716.98
8.0.80.0130.01016.83
8.0.70.0000.00816.82
8.0.60.0030.00616.80
8.0.50.0000.00716.79
8.0.30.0140.00616.96
8.0.20.0120.00617.40
8.0.10.0040.00417.07
8.0.00.0120.00616.75
7.4.330.0050.00015.00
7.4.320.0000.00716.44
7.4.300.0030.00316.56
7.4.290.0000.00716.62
7.4.280.0080.00016.60
7.4.270.0030.00416.45
7.4.260.0030.00316.41
7.4.250.0000.00716.51
7.4.240.0040.00316.64
7.4.230.0030.00316.61
7.4.220.0030.01416.65
7.4.210.0090.00716.57
7.4.200.0000.00716.42
7.4.190.0070.00016.77
7.4.160.0130.01016.60
7.4.150.0120.00617.40
7.4.140.0100.00817.86
7.4.130.0030.01316.56
7.4.120.0060.01216.55
7.4.110.0070.01016.44
7.4.100.0120.00916.55
7.4.90.0090.00916.41
7.4.80.0120.01219.39
7.4.70.0070.01616.44
7.4.60.0130.00916.53
7.4.50.0090.00016.75
7.4.40.0060.01022.77
7.4.30.0060.01116.69
7.4.00.0060.01015.19
7.3.330.0050.00213.43
7.3.320.0000.00513.45
7.3.310.0080.00016.44
7.3.300.0000.00816.46
7.3.290.0080.01116.41
7.3.280.0070.01016.46
7.3.270.0120.00617.40
7.3.260.0070.01016.53
7.3.250.0100.00816.60
7.3.240.0090.00916.41
7.3.230.0070.01416.40
7.3.210.0180.00316.34
7.3.200.0060.01219.39
7.3.190.0070.01316.58
7.3.180.0120.00316.37
7.3.170.0080.01116.66
7.3.160.0100.01016.35
7.3.120.0000.01814.60
7.3.10.0040.00816.50
7.3.00.0060.00316.40
7.2.330.0030.01316.82
7.2.320.0100.01016.73
7.2.310.0090.01316.71
7.2.300.0190.02516.87
7.2.290.0030.01316.48
7.2.130.0030.00917.04
7.2.120.0060.00917.00
7.2.110.0110.00717.05
7.2.100.0000.01117.09
7.2.90.0060.00917.09
7.2.80.0060.00616.78
7.2.70.0000.01316.95
7.2.60.0030.01016.95
7.2.50.0040.01117.01
7.2.40.0040.01216.88
7.2.30.0000.01516.93
7.2.20.0090.00616.73
7.2.10.0030.01316.68
7.2.00.0020.01418.25
7.1.250.0040.00715.95
7.1.200.0070.00716.00
7.1.100.0060.00617.77
7.1.70.0000.01117.29
7.1.60.0060.01219.46
7.1.50.0000.01417.05
7.1.00.0070.07322.33
7.0.200.0070.00016.52
7.0.140.0070.07022.09
7.0.60.0100.06019.88
7.0.50.0030.08717.88
7.0.40.0030.05320.30
7.0.30.0470.05020.07
7.0.20.0270.05020.26
7.0.10.0030.05320.09
7.0.00.0100.07320.23
5.6.280.0100.07020.90
5.6.210.0170.07320.70
5.6.200.0000.04318.28
5.6.190.0030.08020.60
5.6.180.0170.03720.75
5.6.170.0300.07320.50
5.6.160.0000.09020.39
5.6.150.0000.06318.25
5.6.140.0100.07718.27
5.6.130.0030.09018.15
5.6.120.0130.08321.01
5.6.110.0070.05721.15
5.6.100.0030.04320.96
5.6.90.0130.08321.10
5.6.80.0100.04720.51
5.6.70.4530.04020.48
5.5.350.0330.06720.41
5.5.340.0130.07017.99
5.5.330.0170.07020.29
5.5.320.0300.07320.32
5.5.310.0270.07720.25
5.5.300.0070.08017.95
5.5.290.0130.06018.06
5.5.280.0030.07020.77
5.5.270.0100.05020.73
5.5.260.0070.08320.89
5.5.250.0130.07720.71
5.5.240.0270.07320.14
5.4.450.0330.08019.54
5.4.440.0300.05719.40
5.4.430.0330.04719.19
5.4.420.0300.07319.64
5.4.410.0300.06719.26
5.4.400.0330.04719.21
5.4.390.0430.06018.88
5.4.380.0370.07018.88
5.4.370.0400.06018.97
5.4.360.0330.07319.09
5.4.350.0300.04719.15
5.4.340.0270.07319.32
5.4.320.0330.04019.23
5.4.310.0330.06719.13
5.4.300.0300.07318.94
5.4.290.0230.07319.13
5.4.280.0300.07019.31
5.4.270.0300.07019.09
5.4.260.0330.06719.08
5.4.250.0270.04719.13
5.4.240.0330.03718.97
5.4.230.0370.06719.09
5.4.220.0330.07019.24
5.4.210.0330.06718.86
5.4.200.0300.04718.93
5.4.190.0300.05019.19
5.4.180.0200.06719.13
5.4.170.0300.06318.86
5.4.160.0330.06319.23
5.4.150.0300.05718.97
5.4.140.0330.06716.57
5.4.130.0270.06716.55
5.4.120.0330.05316.38
5.4.110.0230.04016.40
5.4.100.0270.03716.52
5.4.90.0200.05316.50
5.4.80.0200.05716.49
5.4.70.0330.07016.30
5.4.60.0370.05016.56
5.4.50.0300.05716.42
5.4.40.0300.04016.32
5.4.30.0330.05016.53
5.4.20.0370.06316.50
5.4.10.0230.07316.15
5.4.00.0370.06015.90
5.3.290.0230.04714.64
5.3.280.0330.04014.57
5.3.270.0300.07014.77
5.3.260.0270.03714.54
5.3.250.0330.06714.62
5.3.240.0330.03014.52
5.3.230.0270.06714.60
5.3.220.0230.07314.48
5.3.210.0330.06714.69
5.3.200.0300.03714.50
5.3.190.0230.04014.73
5.3.180.0400.06314.62
5.3.170.0270.07314.47
5.3.160.0270.06014.50
5.3.150.0330.05314.65
5.3.140.0300.04314.48
5.3.130.0370.06714.56
5.3.120.0370.05714.56
5.3.110.0230.08014.53
5.3.100.0330.07014.04
5.3.90.0270.07014.19
5.3.80.0230.05314.02
5.3.70.0230.06713.94
5.3.60.0400.03313.99
5.3.50.0370.06314.07
5.3.40.0300.03713.88
5.3.30.0330.06013.93
5.3.20.0230.04013.72
5.3.10.0300.06313.82
5.3.00.0300.04713.65
5.2.170.0270.02312.89
5.2.160.0270.05712.89
5.2.150.0230.06312.89
5.2.140.0230.03012.89
5.2.130.0230.06012.89
5.2.120.0200.06312.89
5.2.110.0200.03012.89
5.2.100.0230.04712.89
5.2.90.0300.05012.89
5.2.80.0200.04712.89
5.2.70.0200.06012.89
5.2.60.0230.06012.89
5.2.50.0270.05312.89
5.2.40.0100.06012.89
5.2.30.0200.05712.89
5.2.20.0230.05312.89
5.2.10.0200.03712.89
5.2.00.0170.04312.89
5.1.60.0170.04312.89
5.1.50.0230.04312.89
5.1.40.0170.05312.89
5.1.30.0270.03012.89
5.1.20.0200.05012.89
5.1.10.0230.05312.89
5.1.00.0200.05312.89
5.0.50.0130.03712.89
5.0.40.0130.04312.89
5.0.30.0170.06012.89
5.0.20.0100.04712.89
5.0.10.0170.03312.89
5.0.00.0130.06312.89
4.4.90.0130.03312.89
4.4.80.0100.03312.89
4.4.70.0070.04012.89
4.4.60.0130.02712.89
4.4.50.0130.03312.89
4.4.40.0130.05012.89
4.4.30.0100.02012.89
4.4.20.0130.02312.89
4.4.10.0130.03312.89
4.4.00.0130.05012.89
4.3.110.0100.03712.89
4.3.100.0130.02712.89
4.3.90.0130.03012.89
4.3.80.0100.05012.89
4.3.70.0130.02712.89
4.3.60.0100.03712.89
4.3.50.0130.03312.89
4.3.40.0200.04012.89
4.3.30.0100.02712.89
4.3.20.0070.02712.89
4.3.10.0030.02712.89
4.3.00.0070.02312.89

preferences:
31.35 ms | 401 KiB | 5 Q