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 $value = $v(); // and a callback! $this->{$key} = $value; } } $test = new Test; // start editing here class Intercept { public function getKey($test) { $array = (array) $test; foreach($array as $k => $v) { print_r($k); } } } $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.0100.01016.50
8.3.50.0160.00721.97
8.3.40.0130.00318.57
8.3.30.0070.00719.09
8.3.20.0040.00420.36
8.3.10.0040.00423.45
8.3.00.0090.00019.26
8.2.180.0110.00718.29
8.2.170.0110.00322.96
8.2.160.0100.01020.38
8.2.150.0120.00624.18
8.2.140.0080.00024.66
8.2.130.0030.00626.16
8.2.120.0120.00321.92
8.2.110.0000.00920.49
8.2.100.0080.00317.84
8.2.90.0040.00419.22
8.2.80.0080.00018.05
8.2.70.0040.00417.75
8.2.60.0040.00418.05
8.2.50.0030.00818.07
8.2.40.0000.00819.94
8.2.30.0040.00818.13
8.2.20.0000.00717.66
8.2.10.0000.00818.07
8.2.00.0000.00917.74
8.1.280.0130.00925.92
8.1.270.0000.00822.18
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0090.00022.14
8.1.230.0080.00323.93
8.1.220.0080.00017.74
8.1.210.0110.00018.77
8.1.200.0030.00617.48
8.1.190.0080.00017.30
8.1.180.0000.00918.10
8.1.170.0080.00418.50
8.1.160.0070.00022.02
8.1.150.0040.00718.64
8.1.140.0040.00417.39
8.1.130.0030.00317.74
8.1.120.0000.00717.51
8.1.110.0090.00017.52
8.1.100.0070.00017.49
8.1.90.0050.00317.47
8.1.80.0040.00417.38
8.1.70.0040.00417.43
8.1.60.0030.00617.55
8.1.50.0040.00417.48
8.1.40.0000.00817.43
8.1.30.0040.00417.50
8.1.20.0040.00417.65
8.1.10.0000.00817.57
8.1.00.0050.00217.43
8.0.300.0040.00419.27
8.0.290.0070.00017.18
8.0.280.0080.00018.50
8.0.270.0070.00017.23
8.0.260.0000.00817.29
8.0.250.0030.00516.91
8.0.240.0070.00017.04
8.0.230.0080.00016.98
8.0.220.0000.00716.97
8.0.210.0060.00316.85
8.0.200.0000.00617.04
8.0.190.0040.00416.92
8.0.180.0050.00516.93
8.0.170.0050.00316.88
8.0.160.0000.00817.03
8.0.150.0070.00016.93
8.0.140.0040.00416.94
8.0.130.0090.00013.45
8.0.120.0080.00016.99
8.0.110.0050.00216.88
8.0.100.0030.00516.79
8.0.90.0040.00416.91
8.0.80.0130.00316.92
8.0.70.0040.00416.82
8.0.60.0070.00016.85
8.0.50.0040.00416.94
8.0.30.0090.01417.32
8.0.20.0060.01217.40
8.0.10.0040.00417.18
8.0.00.0090.00916.82
7.4.330.0050.00015.00
7.4.320.0000.00716.43
7.4.300.0030.00316.45
7.4.290.0030.00316.61
7.4.280.0030.00316.60
7.4.270.0000.00716.61
7.4.260.0030.00316.49
7.4.250.0000.00816.61
7.4.240.0070.00016.65
7.4.230.0030.00316.30
7.4.220.0090.00916.55
7.4.210.0120.00416.64
7.4.200.0000.00716.63
7.4.190.0030.00316.47
7.4.160.0080.00816.50
7.4.150.0070.01017.40
7.4.140.0100.00717.86
7.4.130.0050.01116.55
7.4.120.0070.00916.57
7.4.110.0050.01416.53
7.4.100.0110.00916.70
7.4.90.0070.01016.50
7.4.80.0100.00719.39
7.4.70.0060.01216.53
7.4.60.0060.01216.66
7.4.50.0030.00316.42
7.4.40.0090.00322.77
7.4.30.0040.01416.53
7.4.00.0000.01314.89
7.3.330.0000.00713.39
7.3.320.0000.00513.18
7.3.310.0040.00416.39
7.3.300.0000.00816.38
7.3.290.0030.01016.35
7.3.280.0080.00816.36
7.3.270.0090.00817.40
7.3.260.0140.00316.39
7.3.250.0080.01316.39
7.3.240.0120.00916.38
7.3.230.0060.01216.47
7.3.210.0140.00716.62
7.3.200.0150.00919.39
7.3.190.0060.01516.36
7.3.180.0060.01016.48
7.3.170.0110.00416.54
7.3.160.0070.01416.46
7.3.120.0070.00714.83
7.3.10.0060.01016.43
7.3.00.0110.00316.79
7.2.330.0130.00316.84
7.2.320.0130.00316.43
7.2.310.0100.00516.70
7.2.300.0100.00716.80
7.2.290.0100.01016.59
7.2.130.0040.01116.66
7.2.120.0060.00916.94
7.2.110.0040.01116.82
7.2.100.0000.01316.90
7.2.90.0040.01116.98
7.2.80.0060.00617.05
7.2.70.0070.00716.79
7.2.60.0060.00916.93
7.2.50.0000.01017.03
7.2.40.0030.01217.11
7.2.30.0000.01217.04
7.2.20.0130.00316.92
7.2.10.0070.00316.79
7.2.00.0030.01018.24
7.1.250.0120.00015.62
7.1.100.0120.00818.38
7.1.70.0030.00616.95
7.1.60.0150.00919.46
7.1.50.0100.01016.61
7.1.00.0030.07322.36
7.0.200.0000.00716.85
7.0.140.0030.07322.09
7.0.110.0200.07719.90
7.0.100.0170.07319.96
7.0.90.0170.07719.94
7.0.80.0230.08019.91
7.0.70.0130.06320.01
7.0.60.0200.07020.04
7.0.50.0100.07720.10
7.0.40.0070.08019.68
7.0.30.0170.07019.88
7.0.20.0070.08319.81
7.0.10.0200.06319.85
7.0.00.0230.06719.75
5.6.280.0000.07721.03
5.6.260.0100.08020.73
5.6.250.0100.07720.61
5.6.240.0030.09020.56
5.6.230.0100.07720.66
5.6.220.0000.08720.62
5.6.210.0100.07720.68
5.6.200.0100.07320.62
5.6.190.0100.05020.69
5.6.180.0130.07320.56
5.6.170.0070.08020.60
5.6.160.0070.08020.64
5.6.150.0030.06020.56
5.6.140.0000.08720.55
5.6.130.0030.08020.47
5.6.120.0070.08020.59
5.6.110.0070.05720.59
5.6.100.0170.07720.65
5.6.90.0070.06720.59
5.6.80.0170.04020.24
5.6.70.0030.08020.01
5.6.60.0130.07319.93
5.6.50.0100.05719.94
5.6.40.0130.07320.02
5.6.30.0130.06319.98
5.6.20.0000.07719.91
5.6.10.0070.06319.92
5.6.00.0100.06020.06
5.5.380.0030.09020.48
5.5.370.0070.04020.54
5.5.360.0070.07720.40
5.5.350.0170.07020.46
5.5.340.0100.07720.75
5.5.330.0030.08720.82
5.5.320.0070.08320.79
5.5.310.0030.08720.81
5.5.300.0130.08020.95
5.5.290.0170.03721.04
5.5.280.0100.07720.97
5.5.270.0130.04320.94
5.5.260.0100.08321.01
5.5.250.0100.07020.79
5.5.240.0130.07720.33
5.5.230.0130.07320.27
5.5.220.0070.07020.36
5.5.210.0030.08020.41
5.5.200.0130.07720.34
5.5.190.0070.08320.25
5.5.180.0070.05020.32
5.5.160.0130.07720.38
5.5.150.0030.05020.30
5.5.140.0100.07720.21
5.5.130.0100.05720.20
5.5.120.0100.07720.26
5.5.110.0130.07320.39
5.5.100.0030.06020.05
5.5.90.0130.07320.23
5.5.80.0100.07020.02
5.5.70.0130.07020.21
5.5.60.0230.05320.22
5.5.50.0100.07320.02
5.5.40.0070.07720.04
5.5.30.0100.04020.26
5.5.20.0070.07320.24
5.5.10.0070.08020.11
5.5.00.0100.04020.02
5.4.450.0070.08319.52
5.4.440.0130.05719.50
5.4.430.0100.04019.66
5.4.420.0070.08319.63
5.4.410.0100.07719.21
5.4.400.0100.07019.04
5.4.390.0030.08319.35
5.4.380.0070.06319.00
5.4.370.0030.08019.32
5.4.360.0030.07719.02
5.4.350.0030.08019.17
5.4.340.0070.07719.21
5.4.320.0070.07318.99
5.4.310.0230.06319.03
5.4.300.0030.08018.98
5.4.290.0100.07019.01
5.4.280.0030.07719.00
5.4.270.0100.07019.18
5.4.260.0030.07719.02
5.4.250.0030.08318.94
5.4.240.0100.06319.14
5.4.230.0030.05019.22
5.4.220.0130.07319.24
5.4.210.0070.07319.14
5.4.200.0130.07019.23
5.4.190.0100.07019.00
5.4.180.0070.06719.21
5.4.170.0130.06319.02
5.4.160.0030.04019.22
5.4.150.0070.06019.16
5.4.140.0030.03716.59
5.4.130.0100.03016.61
5.4.120.0030.04716.56
5.4.110.0100.03316.32
5.4.100.0070.03316.42
5.4.90.0030.03316.57
5.4.80.0070.03716.45
5.4.70.0070.03316.61
5.4.60.0070.04016.29
5.4.50.0000.03716.57
5.4.40.0000.04716.53
5.4.30.0000.03316.23
5.4.20.0030.05316.53
5.4.10.0000.04016.56
5.4.00.0000.05315.96
5.3.290.0030.06014.75
5.3.280.0170.06314.61
5.3.270.0000.07714.76
5.3.260.0030.06014.57
5.3.250.0130.05314.74
5.3.240.0000.04014.59
5.3.230.0030.04314.61
5.3.220.0030.04314.70
5.3.210.0030.05314.56
5.3.200.0030.03714.71
5.3.190.0030.04014.70
5.3.180.0000.04014.57
5.3.170.0030.03714.70
5.3.160.0030.04014.66
5.3.150.0070.05014.59
5.3.140.0030.04014.68
5.3.130.0030.06714.78
5.3.120.0030.03714.53
5.3.110.0000.04014.59
5.3.100.0070.03314.02
5.3.90.0030.05314.16
5.3.80.0030.03314.08
5.3.70.0000.03714.03
5.3.60.0100.03714.07
5.3.50.0030.05314.08
5.3.40.0000.03713.93
5.3.30.0000.03714.06
5.3.20.0030.03313.79
5.3.10.0030.03313.66
5.3.00.0000.03713.65
5.2.170.0030.05011.87
5.2.160.0000.03011.87
5.2.150.0030.04311.87
5.2.140.0030.03711.87
5.2.130.0030.02711.87
5.2.120.0000.04011.87
5.2.110.0030.02711.87
5.2.100.0070.02711.87
5.2.90.0030.05711.87
5.2.80.0000.03011.87
5.2.70.0100.05311.87
5.2.60.0030.03711.87
5.2.50.0000.03311.87
5.2.40.0030.03011.87
5.2.30.0030.02711.87
5.2.20.0030.02711.87
5.2.10.0070.05011.87
5.2.00.0030.03311.87
5.1.60.0030.02311.87
5.1.50.0000.02311.87
5.1.40.0000.02711.87
5.1.30.0000.02711.87
5.1.20.0000.02711.87
5.1.10.0030.03011.87
5.1.00.0030.02311.87
5.0.50.0000.02311.87
5.0.40.0000.02011.87
5.0.30.0000.03011.87
5.0.20.0030.03311.87
5.0.10.0000.02011.87
5.0.00.0030.03011.87
4.4.90.0070.01711.87
4.4.80.0070.01011.87
4.4.70.0030.01311.87
4.4.60.0000.02011.87
4.4.50.0000.01711.87
4.4.40.0070.03711.87
4.4.30.0030.01011.87
4.4.20.0000.01711.87
4.4.10.0000.01711.87
4.4.00.0000.02711.87
4.3.110.0030.01311.87
4.3.100.0000.01311.87
4.3.90.0030.03011.87
4.3.80.0030.02311.87
4.3.70.0000.03011.87
4.3.60.0000.01711.87
4.3.50.0000.01711.87
4.3.40.0030.02711.87
4.3.30.0000.02711.87
4.3.20.0000.02311.87
4.3.10.0000.01711.87
4.3.00.0100.02311.87

preferences:
36.85 ms | 401 KiB | 5 Q