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[0] = 'dobee'; //$test->__set($array[$first_key] , $blah ); foreach($array as $k => $v) { //print_r($k); if($k == 'Testsecret') { print_r(); } //print_r($v); } } } $intercept = new Intercept; $intercept->getKey($test); // end editing here //echo $test->run(); $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.0000.01416.59
8.3.50.0250.00422.05
8.3.40.0100.00718.71
8.3.30.0070.00719.17
8.3.20.0080.00020.14
8.3.10.0040.00421.73
8.3.00.0040.00419.38
8.2.180.0070.00718.66
8.2.170.0090.00922.96
8.2.160.0130.00020.57
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0130.00626.16
8.2.120.0040.00421.96
8.2.110.0000.00922.18
8.2.100.0000.01117.84
8.2.90.0000.00719.17
8.2.80.0090.00017.97
8.2.70.0080.00317.75
8.2.60.0030.00518.03
8.2.50.0080.00018.07
8.2.40.0040.00419.95
8.2.30.0040.00418.10
8.2.20.0040.00417.88
8.2.10.0070.00318.11
8.2.00.0080.00317.76
8.1.280.0110.00725.92
8.1.270.0050.00323.77
8.1.260.0060.00326.35
8.1.250.0000.00828.09
8.1.240.0000.00924.02
8.1.230.0080.00419.01
8.1.220.0030.00517.74
8.1.210.0030.00518.77
8.1.200.0000.01017.38
8.1.190.0040.00417.41
8.1.180.0040.00418.10
8.1.170.0000.00918.63
8.1.160.0000.00722.05
8.1.150.0080.00018.67
8.1.140.0070.00017.48
8.1.130.0000.00817.77
8.1.120.0080.00017.52
8.1.110.0030.00517.44
8.1.100.0000.01017.42
8.1.90.0000.00717.46
8.1.80.0000.00817.54
8.1.70.0070.00017.47
8.1.60.0000.00817.64
8.1.50.0040.00417.49
8.1.40.0000.00717.45
8.1.30.0050.00317.60
8.1.20.0080.00017.55
8.1.10.0040.00417.58
8.1.00.0030.00617.47
8.0.300.0040.00420.86
8.0.290.0040.00417.18
8.0.280.0030.00318.39
8.0.270.0000.00717.29
8.0.260.0030.00317.21
8.0.250.0040.00416.89
8.0.240.0000.00817.07
8.0.230.0000.00717.09
8.0.220.0000.00817.03
8.0.210.0030.00316.99
8.0.200.0000.00817.09
8.0.190.0030.00617.11
8.0.180.0040.00417.09
8.0.170.0040.00416.90
8.0.160.0070.00016.97
8.0.150.0080.00016.99
8.0.140.0030.00516.95
8.0.130.0000.00613.40
8.0.120.0040.00416.84
8.0.110.0050.00216.88
8.0.100.0040.00417.10
8.0.90.0040.00416.84
8.0.80.0130.01016.91
8.0.70.0040.00417.05
8.0.60.0000.00816.98
8.0.50.0000.00816.86
8.0.30.0100.00917.09
8.0.20.0120.00717.41
8.0.10.0070.00016.89
8.0.00.0070.01016.77
7.4.330.0000.00515.00
7.4.320.0060.00016.65
7.4.300.0030.00316.50
7.4.290.0030.00316.64
7.4.280.0070.00016.54
7.4.270.0000.00716.56
7.4.260.0040.00416.61
7.4.250.0040.00416.52
7.4.240.0030.00316.46
7.4.230.0040.00416.35
7.4.220.0070.01116.54
7.4.210.0090.00516.64
7.4.200.0000.00716.64
7.4.190.0040.00416.44
7.4.160.0060.00916.45
7.4.150.0110.00617.40
7.4.140.0140.00517.86
7.4.130.0070.01216.66
7.4.120.0090.00816.55
7.4.110.0080.00816.70
7.4.100.0130.00616.64
7.4.90.0100.00716.45
7.4.80.0100.00719.39
7.4.70.0030.01316.46
7.4.60.0140.00316.46
7.4.50.0030.00316.61
7.4.40.0110.00622.77
7.4.30.0090.01216.62
7.4.00.0030.01414.93
7.3.330.0030.00313.43
7.3.320.0060.00013.44
7.3.310.0000.00716.33
7.3.300.0000.01016.38
7.3.290.0090.00616.38
7.3.280.0080.00916.43
7.3.270.0090.00617.40
7.3.260.0120.00916.30
7.3.250.0110.00816.52
7.3.240.0120.00616.63
7.3.230.0030.01916.39
7.3.210.0030.01416.37
7.3.200.0090.00619.39
7.3.190.0030.01416.40
7.3.180.0160.00616.46
7.3.170.0150.00016.47
7.3.160.0060.00916.51
7.3.120.0090.00614.88
7.3.110.0120.00314.46
7.3.100.0070.00714.67
7.3.90.0090.00614.80
7.3.80.0060.00915.10
7.3.70.0110.00714.87
7.3.60.0100.00314.64
7.3.50.0060.00314.86
7.3.40.0030.00714.57
7.3.30.0040.00814.93
7.3.20.0120.00316.80
7.3.10.0060.00616.90
7.3.00.0030.00716.49
7.2.330.0090.00916.61
7.2.320.0110.01116.80
7.2.310.0130.00316.55
7.2.300.0030.01316.84
7.2.290.0180.00016.87
7.2.240.0040.01515.13
7.2.230.0070.00714.63
7.2.220.0090.00615.03
7.2.210.0090.00915.37
7.2.200.0060.00615.28
7.2.190.0100.00715.04
7.2.180.0080.00415.16
7.2.170.0030.00915.21
7.2.160.0050.00515.08
7.2.150.0000.00916.71
7.2.140.0070.00717.09
7.2.130.0000.01416.90
7.2.120.0030.00816.88
7.2.110.0070.00317.03
7.2.100.0030.00917.16
7.2.90.0090.00617.08
7.2.80.0060.00917.00
7.2.70.0000.01516.97
7.2.60.0070.00717.12
7.2.50.0040.01117.09
7.2.40.0070.00717.05
7.2.30.0090.00617.03
7.2.20.0040.01116.93
7.2.10.0030.01216.93
7.2.00.0020.01218.17
7.1.330.0140.00015.88
7.1.320.0070.00715.80
7.1.310.0030.00715.75
7.1.300.0070.00715.57
7.1.290.0000.00815.59
7.1.280.0040.00815.73
7.1.270.0000.00815.61
7.1.260.0030.00915.81
7.1.250.0040.01115.81
7.1.100.0070.01017.92
7.1.70.0110.00717.33
7.1.60.0070.01719.46
7.1.50.0090.01616.85
7.1.00.0070.07322.56
7.0.200.0040.00416.77
7.0.140.0070.07022.16
7.0.60.0170.06320.03
7.0.50.0100.07317.98
7.0.40.0100.03719.91
7.0.30.0530.06720.39
7.0.20.0230.08020.22
7.0.10.0030.09320.10
7.0.00.0170.03020.26
5.6.210.0100.08020.48
5.6.200.0070.07718.15
5.6.190.0070.06720.48
5.6.180.0200.07320.48
5.6.170.0200.03720.40
5.6.160.0070.07720.48
5.6.150.0070.08318.19
5.6.140.0030.04018.23
5.6.130.0030.08018.20
5.6.120.0170.04021.07
5.6.110.0170.07020.99
5.6.100.0170.07320.99
5.6.90.0070.06020.98
5.6.80.0130.06020.52
5.6.70.2870.03720.52
5.5.350.0230.09020.30
5.5.340.0070.03718.02
5.5.330.0030.04020.13
5.5.320.0300.07320.28
5.5.310.0170.04320.31
5.5.300.0100.06017.98
5.5.290.0100.05317.98
5.5.280.0070.04020.77
5.5.270.0130.07720.73
5.5.260.0100.08320.90
5.5.250.0030.05320.72
5.5.240.4200.04020.29
5.4.450.0130.04319.31
5.4.440.0230.03719.54
5.4.430.0200.04719.17
5.4.420.0130.04319.41
5.4.410.0170.04719.29
5.4.400.0300.03019.23
5.4.390.0200.04318.99
5.4.380.0130.04018.95
5.4.370.0170.03718.83
5.4.360.0200.06318.98
5.4.350.0270.05718.87
5.4.340.0200.03718.87
5.4.320.0100.04319.08
5.4.310.0230.03319.31
5.4.300.0200.03719.24
5.4.290.0230.05319.16
5.4.280.0100.04018.87
5.4.270.0170.05019.13
5.4.260.0230.03718.98
5.4.250.0100.06018.90
5.4.240.0100.04718.94
5.4.230.0100.04319.07
5.4.220.0130.04318.94
5.4.210.0130.04019.23
5.4.200.0170.03318.85
5.4.190.0130.04318.93
5.4.180.0200.03319.12
5.4.170.0200.04019.14
5.4.160.0270.06018.85
5.4.150.0200.04019.09
5.4.140.0170.06016.75
5.4.130.0170.03316.39
5.4.120.0130.07016.70
5.4.110.0230.03316.31
5.4.100.0230.03716.33
5.4.90.0270.05016.26
5.4.80.0130.03316.23
5.4.70.0170.03316.41
5.4.60.0130.04016.53
5.4.50.0130.03716.44
5.4.40.0130.04016.45
5.4.30.0200.05316.23
5.4.20.0200.02716.37
5.4.10.0200.04316.42
5.4.00.0130.04016.09
5.3.290.0100.08014.79
5.3.280.0100.04314.61
5.3.270.0170.05014.64
5.3.260.0170.06014.58
5.3.250.0070.05014.51
5.3.240.0130.04714.70
5.3.230.0170.03314.57
5.3.220.0200.03014.57
5.3.210.0200.03314.59
5.3.200.0230.05014.49
5.3.190.0130.04314.61
5.3.180.0130.03714.48
5.3.170.0270.03014.54
5.3.160.0130.04014.54
5.3.150.0200.05314.58
5.3.140.0170.03314.48
5.3.130.0100.04314.46
5.3.120.0170.03714.63
5.3.110.0100.04014.55
5.3.100.0200.03014.12
5.3.90.0230.02714.14
5.3.80.0130.03713.95
5.3.70.0100.04013.95
5.3.60.0200.03713.91
5.3.50.0270.03013.86
5.3.40.0130.03713.87
5.3.30.0130.03713.97
5.3.20.0270.04013.79
5.3.10.0200.03713.58
5.3.00.0200.05013.67
5.2.170.0170.03011.11
5.2.160.0230.03311.16
5.2.150.0070.03311.08
5.2.140.0170.02711.20
5.2.130.0230.01711.03
5.2.120.0130.02711.07
5.2.110.0070.03311.03
5.2.100.0100.03011.07
5.2.90.0130.04711.04
5.2.80.0170.02711.19
5.2.70.0030.03711.19
5.2.60.0130.05011.04
5.2.50.0170.04010.93
5.2.40.0130.02710.96
5.2.30.0130.02711.03
5.2.20.0130.02710.86
5.2.10.0100.03010.84
5.2.00.0130.03010.80
5.1.60.0130.03310.16
5.1.50.0070.02710.14
5.1.40.0100.02710.14
5.1.30.0070.03010.27
5.1.20.0030.03010.27
5.1.10.0100.03010.23
5.1.00.0170.03310.20
5.0.50.0070.02310.14
5.0.40.0070.02010.14
5.0.30.0070.03710.14
5.0.20.0100.02010.14
5.0.10.0100.02010.14
5.0.00.0100.05710.14
4.4.90.0070.02010.14
4.4.80.0030.02010.14
4.4.70.0030.01710.14
4.4.60.0030.01710.14
4.4.50.0070.02010.14
4.4.40.0070.02710.14
4.4.30.0000.02010.14
4.4.20.0030.01710.14
4.4.10.0100.02010.14
4.4.00.0070.02710.14
4.3.110.0030.01710.14
4.3.100.0130.01310.14
4.3.90.0030.03010.14
4.3.80.0030.03310.14
4.3.70.0100.01310.14
4.3.60.0030.03010.14
4.3.50.0030.01710.14
4.3.40.0130.02010.14
4.3.30.0000.01710.14
4.3.20.0000.02710.14
4.3.10.0030.01710.14
4.3.00.0070.01310.14

preferences:
37.74 ms | 401 KiB | 5 Q