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['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.0040.01116.61
8.3.50.0200.01021.88
8.3.40.0170.00318.92
8.3.30.0110.00418.92
8.3.20.0080.00020.18
8.3.10.0030.00623.48
8.3.00.0080.00019.51
8.2.180.0140.00418.41
8.2.170.0100.00722.96
8.2.160.0100.00720.52
8.2.150.0040.00424.18
8.2.140.0050.00224.66
8.2.130.0070.00726.16
8.2.120.0050.00322.30
8.2.110.0050.00522.10
8.2.100.0060.00617.78
8.2.90.0050.00319.05
8.2.80.0080.00017.97
8.2.70.0000.00917.63
8.2.60.0070.00417.90
8.2.50.0030.00618.07
8.2.40.0080.00019.94
8.2.30.0040.00417.96
8.2.20.0070.00017.63
8.2.10.0030.00517.99
8.2.00.0080.00017.75
8.1.270.0050.00323.77
8.1.260.0060.00326.35
8.1.250.0040.00428.09
8.1.240.0030.00723.92
8.1.230.0070.00419.02
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0030.00617.23
8.1.190.0040.00417.51
8.1.180.0060.00619.14
8.1.170.0040.00418.56
8.1.160.0060.00321.84
8.1.150.0030.00518.63
8.1.140.0040.00417.30
8.1.130.0000.00717.73
8.1.120.0000.00717.44
8.1.110.0060.00317.41
8.1.100.0040.00417.29
8.1.90.0000.00717.45
8.1.80.0000.00717.44
8.1.70.0030.00317.41
8.1.60.0030.00617.46
8.1.50.0000.00817.54
8.1.40.0080.00017.43
8.1.30.0040.00417.64
8.1.20.0000.00717.73
8.1.10.0040.00417.55
8.1.00.0030.00617.43
8.0.300.0040.00420.71
8.0.290.0080.00017.16
8.0.280.0030.00318.27
8.0.270.0070.00017.21
8.0.260.0030.00517.25
8.0.250.0040.00417.03
8.0.240.0030.00316.90
8.0.230.0030.00316.84
8.0.220.0070.00016.79
8.0.210.0100.00016.91
8.0.200.0060.00016.83
8.0.190.0090.00016.86
8.0.180.0060.00616.89
8.0.170.0000.00816.93
8.0.160.0000.00816.80
8.0.150.0000.00716.73
8.0.140.0040.00416.82
8.0.130.0000.00613.30
8.0.120.0000.00816.77
8.0.110.0000.00716.79
8.0.100.0000.00716.81
8.0.90.0050.00216.90
8.0.80.0120.00616.87
8.0.70.0030.00516.91
8.0.60.0060.00316.88
8.0.50.0040.00416.83
8.0.30.0020.01717.29
8.0.20.0090.01017.40
8.0.10.0080.00016.86
8.0.00.0100.00716.70
7.4.330.0000.00515.00
7.4.320.0000.00816.47
7.4.300.0050.00216.59
7.4.290.0050.00316.48
7.4.280.0030.00616.52
7.4.270.0080.00016.44
7.4.260.0030.00316.64
7.4.250.0000.00716.48
7.4.240.0050.00216.48
7.4.230.0000.00716.41
7.4.220.0130.00616.46
7.4.210.0080.00716.53
7.4.200.0000.00716.36
7.4.190.0070.00016.49
7.4.160.0130.01016.41
7.4.150.0090.00917.40
7.4.140.0100.00717.86
7.4.130.0040.01316.63
7.4.120.0090.00916.53
7.4.110.0070.01016.36
7.4.100.0090.00916.38
7.4.90.0060.01216.44
7.4.80.0030.02019.39
7.4.70.0120.00616.65
7.4.60.0100.00716.45
7.4.50.0030.00616.54
7.4.40.0070.01022.77
7.4.30.0060.01116.75
7.4.00.0100.00615.07
7.3.330.0000.00713.41
7.3.320.0000.00613.42
7.3.310.0040.00416.41
7.3.300.0030.00616.43
7.3.290.0030.01016.45
7.3.280.0070.01316.43
7.3.270.0150.00317.40
7.3.260.0000.01716.64
7.3.250.0070.01016.46
7.3.240.0040.01316.52
7.3.230.0130.00416.52
7.3.210.0060.01316.40
7.3.200.0150.00319.39
7.3.190.0190.00316.41
7.3.180.0110.00416.61
7.3.170.0080.00916.33
7.3.160.0110.01216.41
7.3.120.0070.01015.01
7.3.10.0180.00016.49
7.3.00.0090.00616.52
7.2.330.0110.00716.73
7.2.320.0140.00916.90
7.2.310.0090.00916.65
7.2.300.0110.01116.85
7.2.290.0060.01216.87
7.2.130.0120.00316.27
7.2.120.0080.00916.42
7.2.110.0200.00316.71
7.2.100.0070.00716.45
7.2.90.0110.01116.70
7.2.80.0000.01816.34
7.2.70.0140.00016.50
7.2.60.0030.01016.77
7.2.50.0030.01016.55
7.2.40.0000.01116.39
7.2.30.0100.00316.57
7.2.20.0080.00416.55
7.2.10.0030.01416.52
7.2.00.0090.00518.11
7.1.250.0090.00615.63
7.1.200.0030.01015.85
7.1.100.0040.00818.21
7.1.70.0000.00817.11
7.1.60.0110.00419.46
7.1.50.0110.00016.92
7.1.00.0030.07022.33
7.0.200.0000.00816.73
7.0.140.0070.07022.09
7.0.60.0130.06320.09
7.0.50.0130.04717.88
7.0.40.0130.08020.21
7.0.30.0230.07020.08
7.0.20.0330.08320.19
7.0.10.0000.04320.25
7.0.00.0100.08020.20
5.6.280.0030.07321.03
5.6.210.0170.07320.64
5.6.200.0130.08018.18
5.6.190.0130.08320.66
5.6.180.0300.07720.58
5.6.170.0270.07720.48
5.6.160.0100.08320.41
5.6.150.0030.05318.14
5.6.140.0030.04018.21
5.6.130.0000.05718.29
5.6.120.0130.08021.13
5.6.110.0100.03720.96
5.6.100.0170.06321.00
5.6.90.0030.07320.98
5.6.80.0070.07720.38
5.5.350.3970.04020.31
5.5.340.0030.08318.08
5.5.330.0070.09020.40
5.5.320.0200.08720.30
5.5.310.0200.05020.51
5.5.300.0070.08317.96
5.5.290.0000.04317.96
5.5.280.0100.06720.87
5.5.270.0030.08320.77
5.5.260.0070.08020.76
5.5.250.0100.07320.59
5.5.240.0400.06320.16
5.4.450.0270.07719.20
5.4.440.0300.04019.42
5.4.430.0270.04719.46
5.4.420.0330.06319.43
5.4.410.0330.06719.32
5.4.400.0270.03719.21
5.4.390.0330.06319.23
5.4.380.0370.06019.08
5.4.370.0270.05319.09
5.4.360.0330.05319.00
5.4.350.0270.05319.09
5.4.340.0270.08019.16
5.4.320.0200.05319.31
5.4.310.0270.07319.13
5.4.300.0200.05018.99
5.4.290.0230.05019.10
5.4.280.0330.06319.08
5.4.270.0230.04719.14
5.4.260.0200.04319.20
5.4.250.0270.06318.99
5.4.240.0130.04719.13
5.4.230.0300.06719.20
5.4.220.0200.05019.21
5.4.210.0200.06318.99
5.4.200.0170.04718.83
5.4.190.0270.03319.05
5.4.180.0230.07318.97
5.4.170.0130.05319.21
5.4.160.0230.06319.04
5.4.150.0200.06318.93
5.4.140.0230.05716.41
5.4.130.0200.07016.55
5.4.120.0230.07016.39
5.4.110.0200.03316.42
5.4.100.0300.03716.63
5.4.90.0200.03716.45
5.4.80.0270.03316.39
5.4.70.0270.05316.57
5.4.60.0170.04716.48
5.4.50.0270.03016.43
5.4.40.0170.05316.34
5.4.30.0300.05716.52
5.4.20.0230.06716.61
5.4.10.0300.03316.25
5.4.00.0200.07015.77
5.3.290.0170.05014.62
5.3.280.0200.07314.68
5.3.270.0170.04714.60
5.3.260.0270.07014.58
5.3.250.0130.05014.63
5.3.240.0200.07314.63
5.3.230.0130.05314.68
5.3.220.0300.05014.57
5.3.210.0200.06014.59
5.3.200.0270.07714.58
5.3.190.0230.04714.49
5.3.180.0200.04314.68
5.3.170.0300.07014.62
5.3.160.0230.04714.54
5.3.150.0170.03714.47
5.3.140.0130.04014.46
5.3.130.0230.04314.56
5.3.120.0270.03714.55
5.3.110.0300.07014.47
5.3.100.0270.06014.06
5.3.90.0370.06014.11
5.3.80.0270.04013.94
5.3.70.0230.06313.94
5.3.60.0330.04713.93
5.3.50.0230.04313.96
5.3.40.0270.04713.86
5.3.30.0270.06313.89
5.3.20.0270.04013.93
5.3.10.0270.05313.81
5.3.00.0270.03313.66
5.2.170.0100.03712.91
5.2.160.0300.05012.91
5.2.150.0200.04312.91
5.2.140.0200.04012.91
5.2.130.0230.05012.91
5.2.120.0230.05712.91
5.2.110.0200.03012.91
5.2.100.0170.04012.91
5.2.90.0230.03712.91
5.2.80.0330.04712.91
5.2.70.0230.03012.91
5.2.60.0170.05312.91
5.2.50.0200.04012.91
5.2.40.0200.05312.91
5.2.30.0100.03312.91
5.2.20.0100.04012.91
5.2.10.0100.03012.91
5.2.00.0200.03312.91
5.1.60.0070.02712.91
5.1.50.0130.02012.91
5.1.40.0130.02012.91
5.1.30.0170.02312.91
5.1.20.0100.03012.91
5.1.10.0170.05312.91
5.1.00.0200.05012.91
5.0.50.0100.02712.91
5.0.40.0100.03312.91
5.0.30.0100.06012.91
5.0.20.0100.03012.91
5.0.10.0170.04012.91
5.0.00.0130.04312.91
4.4.90.0070.03712.91
4.4.80.0100.03312.91
4.4.70.0030.03012.91
4.4.60.0070.04012.91
4.4.50.0070.02012.91
4.4.40.0100.02712.91
4.4.30.0030.03012.91
4.4.20.0070.01712.91
4.4.10.0070.02012.91
4.4.00.0070.03012.91
4.3.110.0070.03712.91
4.3.100.0100.02012.91
4.3.90.0130.03012.91
4.3.80.0070.03012.91
4.3.70.0070.03312.91
4.3.60.0100.02312.91
4.3.50.0100.02012.91
4.3.40.0170.03712.91
4.3.30.0100.02312.91
4.3.20.0000.03012.91
4.3.10.0030.02312.91
4.3.00.0070.02312.91

preferences:
60.23 ms | 400 KiB | 5 Q