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('KEY:::'.$k); if($k == Testsecret) { print_r($array[$k]); } //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.70.0120.00918.43
8.3.60.0200.00318.43
8.3.50.0150.00621.98
8.3.40.0130.00618.95
8.3.30.0070.00719.04
8.3.20.0120.00320.19
8.3.10.0040.00421.91
8.3.00.0120.00319.50
8.2.180.0070.01518.54
8.2.170.0090.00622.96
8.2.160.0070.00720.58
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0050.00326.16
8.2.120.0040.00422.25
8.2.110.0060.00322.26
8.2.100.0040.00717.97
8.2.90.0000.00919.40
8.2.80.0040.00417.97
8.2.70.0040.00417.75
8.2.60.0040.00418.03
8.2.50.0040.00418.07
8.2.40.0040.00419.88
8.2.30.0040.00418.24
8.2.20.0030.00617.82
8.2.10.0000.00817.96
8.2.00.0060.00317.89
8.1.280.0040.01825.92
8.1.270.0000.00824.01
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0060.00323.91
8.1.230.0090.00319.16
8.1.220.0030.00617.78
8.1.210.0000.00818.77
8.1.200.0000.00917.35
8.1.190.0080.00017.53
8.1.180.0060.00318.10
8.1.170.0060.00318.63
8.1.160.0060.00322.08
8.1.150.0000.01018.71
8.1.140.0000.00717.48
8.1.130.0000.00717.76
8.1.120.0030.00617.42
8.1.110.0070.00417.39
8.1.100.0050.00217.44
8.1.90.0070.00017.41
8.1.80.0040.00417.46
8.1.70.0040.00417.37
8.1.60.0070.00017.49
8.1.50.0050.00317.48
8.1.40.0090.00017.54
8.1.30.0040.00417.60
8.1.20.0050.00317.67
8.1.10.0000.00817.62
8.1.00.0000.00817.46
8.0.300.0000.00820.78
8.0.290.0030.00317.18
8.0.280.0000.00818.36
8.0.270.0070.00017.39
8.0.260.0030.00317.22
8.0.250.0070.00017.07
8.0.240.0000.00717.03
8.0.230.0030.00517.04
8.0.220.0070.00016.94
8.0.210.0000.00717.02
8.0.200.0030.00316.97
8.0.190.0000.00917.08
8.0.180.0080.00016.98
8.0.170.0040.00417.03
8.0.160.0000.00716.95
8.0.150.0040.00416.82
8.0.140.0040.00416.84
8.0.130.0030.00313.36
8.0.120.0000.00816.88
8.0.110.0070.00017.05
8.0.100.0090.00017.04
8.0.90.0000.00717.04
8.0.80.0110.01116.97
8.0.70.0000.00716.96
8.0.60.0050.00316.81
8.0.50.0040.00417.00
8.0.30.0100.01017.08
8.0.20.0100.01017.40
8.0.10.0040.00417.13
8.0.00.0080.00916.76
7.4.330.0060.00015.00
7.4.320.0000.00616.63
7.4.300.0030.00316.63
7.4.290.0080.00016.63
7.4.280.0000.00716.63
7.4.270.0070.00016.55
7.4.260.0070.00016.56
7.4.250.0030.00516.51
7.4.240.0020.00516.62
7.4.230.0030.00316.65
7.4.220.0170.00716.64
7.4.210.0080.00716.63
7.4.200.0000.00816.73
7.4.190.0000.00716.39
7.4.160.0080.00816.66
7.4.150.0100.00717.40
7.4.140.0100.00717.86
7.4.130.0070.01016.50
7.4.120.0180.00316.66
7.4.110.0070.01116.49
7.4.100.0090.01616.53
7.4.90.0070.01116.37
7.4.80.0040.01619.39
7.4.70.0120.00616.64
7.4.60.0030.01316.57
7.4.50.0080.00016.66
7.4.40.0000.01422.77
7.4.30.0070.01416.69
7.4.00.0090.00615.10
7.3.330.0000.00713.45
7.3.320.0030.00313.44
7.3.310.0000.00716.42
7.3.300.0050.00316.41
7.3.290.0080.00616.41
7.3.280.0090.00616.43
7.3.270.0140.00317.40
7.3.260.0040.01216.60
7.3.250.0080.01316.52
7.3.240.0090.00816.59
7.3.230.0100.00716.45
7.3.210.0070.01116.34
7.3.200.0070.01619.39
7.3.190.0070.01016.43
7.3.180.0060.00916.30
7.3.170.0060.00916.43
7.3.160.0090.00616.39
7.3.120.0060.00914.87
7.2.330.0120.00616.64
7.2.320.0100.01016.79
7.2.310.0080.00816.70
7.2.300.0030.01416.58
7.2.290.0030.01616.89
7.2.60.0070.00717.12
7.2.00.0000.01219.46
7.1.200.0040.00715.82
7.1.100.0030.01018.28
7.1.70.0090.00916.51
7.1.60.0070.01819.46
7.1.50.0030.01717.02
7.1.00.0030.07722.44
7.0.200.0000.00716.81
7.0.140.0000.07722.13
7.0.110.0130.04019.83
7.0.100.0200.07319.89
7.0.90.0130.08719.94
7.0.80.0130.05319.80
7.0.70.0100.06020.02
7.0.60.0130.08319.90
7.0.50.0100.08320.30
7.0.40.0030.08719.99
7.0.30.0200.05020.11
7.0.20.0030.07720.07
7.0.10.0100.08320.00
7.0.00.0030.08319.98
5.6.280.0070.06721.13
5.6.260.0070.08720.65
5.6.250.0000.08020.70
5.6.240.0070.08020.59
5.6.230.0100.08320.61
5.6.220.0070.08020.58
5.6.210.0030.08320.68
5.6.200.0170.07721.01
5.6.190.0130.07720.90
5.6.180.0100.07321.14
5.6.170.0170.07321.14
5.6.160.0170.06721.10
5.6.150.0100.08021.10
5.6.140.0030.09021.09
5.6.130.0100.07021.10
5.6.120.0070.08020.88
5.6.110.0070.07720.96
5.6.100.0170.08321.00
5.6.90.0170.07321.12
5.6.80.0070.07020.43
5.6.70.0100.07020.47
5.6.60.0070.08320.31
5.6.50.0030.08020.29
5.6.40.0000.08320.45
5.6.30.0000.08020.43
5.6.20.0130.07020.50
5.6.10.0130.07320.45
5.6.00.0100.05020.28
5.5.380.0030.04720.37
5.5.370.0030.07720.43
5.5.360.0100.07720.51
5.5.350.0030.07320.43
5.5.340.0100.08320.91
5.5.330.0130.08020.70
5.5.320.0130.07020.83
5.5.310.0100.08020.91
5.5.300.0100.06720.91
5.5.290.0170.07320.70
5.5.280.0070.08321.00
5.5.270.0130.07720.82
5.5.260.0100.08320.82
5.5.250.0130.06720.51
5.5.240.0100.07320.04
5.5.230.0030.08720.15
5.5.220.0170.06720.30
5.5.210.0130.07320.15
5.5.200.0170.06720.02
5.5.190.0070.04720.26
5.5.180.0100.08020.33
5.5.160.0070.07720.11
5.5.150.0130.07020.32
5.5.140.0130.07320.33
5.5.130.0000.08320.30
5.5.120.0070.06720.28
5.5.110.0100.04320.19
5.5.100.0070.07720.13
5.5.90.0070.07020.03
5.5.80.0170.06720.06
5.5.70.0070.08019.95
5.5.60.0130.07020.09
5.5.50.0200.06319.98
5.5.40.0030.07719.96
5.5.30.0100.08020.19
5.5.20.0030.08019.94
5.5.10.0030.07020.18
5.5.00.0130.07020.10
5.4.450.0100.08019.34
5.4.440.0100.04319.32
5.4.430.0200.04319.63
5.4.420.0070.08019.34
5.4.410.0100.07019.14
5.4.400.0030.04719.16
5.4.390.0030.04719.03
5.4.380.0030.08019.34
5.4.370.0100.06719.29
5.4.360.0030.07718.95
5.4.350.0100.07319.32
5.4.340.0170.06319.02
5.4.320.0070.06318.96
5.4.310.0070.07318.99
5.4.300.0130.03719.22
5.4.290.0070.06319.02
5.4.280.0200.06019.13
5.4.270.0130.06719.22
5.4.260.0070.07319.04
5.4.250.0030.07319.24
5.4.240.0030.07319.30
5.4.230.0200.04019.20
5.4.220.0070.08019.02
5.4.210.0070.06719.08
5.4.200.0030.07719.00
5.4.190.0000.07718.96
5.4.180.0070.07319.17
5.4.170.0070.07319.08
5.4.160.0130.07018.98
5.4.150.0070.07319.32
5.4.140.0100.07016.36
5.4.130.0100.06316.38
5.4.120.0000.04716.29
5.4.110.0130.05316.46
5.4.100.0130.07316.61
5.4.90.0030.04316.65
5.4.80.0030.06016.54
5.4.70.0100.06716.50
5.4.60.0070.07316.48
5.4.50.0030.07316.48
5.4.40.0130.06716.61
5.4.30.0070.07016.47
5.4.20.0000.07016.28
5.4.10.0070.06716.54
5.4.00.0030.08015.99
5.3.290.0070.07714.90
5.3.280.0000.08314.61
5.3.270.0000.08714.63
5.3.260.0000.06014.62
5.3.250.0130.06714.74
5.3.240.0070.04314.61
5.3.230.0070.07714.74
5.3.220.0000.07714.70
5.3.210.0070.07314.55
5.3.200.0070.04014.58
5.3.190.0030.08314.61
5.3.180.0030.04314.58
5.3.170.0100.06714.70
5.3.160.0170.06014.53
5.3.150.0170.04714.58
5.3.140.0100.05014.64
5.3.130.0130.06714.57
5.3.120.0100.07314.68
5.3.110.0070.07014.64
5.3.100.0200.07014.18
5.3.90.0100.05314.16
5.3.80.0200.02714.11
5.3.70.0100.07014.04
5.3.60.0200.04714.01
5.3.50.0030.07714.02
5.3.40.0100.07013.95
5.3.30.0070.07313.78
5.3.20.0130.06713.83
5.3.10.0130.06313.64
5.3.00.0100.05713.73
5.2.170.0000.06711.22
5.2.160.0030.05711.13
5.2.150.0100.05011.15
5.2.140.0030.06711.15
5.2.130.0000.06311.12
5.2.120.0030.04311.11
5.2.110.0070.06011.34
5.2.100.0000.06711.14
5.2.90.0130.04711.13
5.2.80.0000.06711.09
5.2.70.0000.04011.23
5.2.60.0130.05311.19
5.2.50.0000.06011.11
5.2.40.0100.05711.01
5.2.30.0200.03011.07
5.2.20.0030.06310.97
5.2.10.0130.05010.96
5.2.00.0030.06010.74
5.1.60.0100.03310.59
5.1.50.0000.05710.59
5.1.40.0100.04010.59
5.1.30.0030.05310.59
5.1.20.0100.03010.59
5.1.10.0130.04710.59
5.1.00.0030.05310.59
5.0.50.0030.04310.59
5.0.40.0070.04310.59
5.0.30.0070.05710.59
5.0.20.0000.04710.59
5.0.10.0000.04310.59
5.0.00.0030.06310.59
4.4.90.0030.03310.59
4.4.80.0000.02010.59
4.4.70.0000.03010.59
4.4.60.0030.03010.59
4.4.50.0030.02710.59
4.4.40.0030.05310.59
4.4.30.0030.02710.59
4.4.20.0000.02710.59
4.4.10.0030.03310.59
4.4.00.0000.05710.59
4.3.110.0000.02010.59
4.3.100.0000.03710.59
4.3.90.0030.03310.59
4.3.80.0030.05310.59
4.3.70.0000.03710.59
4.3.60.0000.03310.59
4.3.50.0000.03010.59
4.3.40.0070.04010.59
4.3.30.0030.02310.59
4.3.20.0030.03310.59
4.3.10.0030.03710.59
4.3.00.0030.03010.59

preferences:
40.68 ms | 401 KiB | 5 Q