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.60.0110.00418.43
8.3.50.0220.00321.95
8.3.40.0100.01018.96
8.3.30.0100.00319.18
8.3.20.0000.00720.33
8.3.10.0050.00223.43
8.3.00.0000.00819.13
8.2.180.0170.00318.41
8.2.170.0120.00322.96
8.2.160.0100.00320.39
8.2.150.0080.00024.18
8.2.140.0150.00024.66
8.2.130.0080.00026.16
8.2.120.0070.00022.29
8.2.110.0030.00620.86
8.2.100.0080.00417.97
8.2.90.0040.00419.30
8.2.80.0080.00017.97
8.2.70.0060.00317.63
8.2.60.0060.00318.16
8.2.50.0060.00318.07
8.2.40.0030.00620.07
8.2.30.0000.00718.20
8.2.20.0080.00017.94
8.2.10.0070.00018.02
8.2.00.0040.00717.82
8.1.280.0130.00625.92
8.1.270.0030.00623.76
8.1.260.0080.00026.35
8.1.250.0030.00628.09
8.1.240.0000.00823.92
8.1.230.0110.00020.97
8.1.220.0030.00617.74
8.1.210.0050.00318.77
8.1.200.0030.00617.35
8.1.190.0080.00017.35
8.1.180.0090.00018.10
8.1.170.0070.00318.48
8.1.160.0040.00421.94
8.1.150.0040.00718.62
8.1.140.0060.00317.44
8.1.130.0030.00317.84
8.1.120.0040.00417.42
8.1.110.0070.00017.38
8.1.100.0000.01017.47
8.1.90.0000.00717.40
8.1.80.0000.00717.49
8.1.70.0070.00017.46
8.1.60.0000.00817.59
8.1.50.0000.00917.57
8.1.40.0000.00717.60
8.1.30.0040.00417.65
8.1.20.0040.00417.59
8.1.10.0000.00817.50
8.1.00.0040.00417.58
8.0.300.0000.00718.77
8.0.290.0070.00016.71
8.0.280.0000.00718.35
8.0.270.0040.00417.22
8.0.260.0000.00617.30
8.0.250.0030.00316.89
8.0.240.0030.00516.88
8.0.230.0070.00017.05
8.0.220.0070.00016.83
8.0.210.0080.00016.98
8.0.200.0030.00317.05
8.0.190.0030.00517.04
8.0.180.0040.00417.01
8.0.170.0000.00716.91
8.0.160.0000.00716.97
8.0.150.0000.00716.82
8.0.140.0040.00417.00
8.0.130.0060.00013.38
8.0.120.0000.00816.95
8.0.110.0000.00816.89
8.0.100.0050.00216.92
8.0.90.0070.00016.82
8.0.80.0160.00616.86
8.0.70.0080.00017.00
8.0.60.0040.00416.85
8.0.50.0000.00716.93
8.0.30.0100.00917.22
8.0.20.0060.01417.40
8.0.10.0030.00616.97
8.0.00.0070.01116.67
7.4.330.0000.00515.00
7.4.320.0000.00616.64
7.4.300.0060.00016.65
7.4.290.0000.00716.63
7.4.280.0040.00416.60
7.4.270.0040.00416.54
7.4.260.0000.00716.44
7.4.250.0040.00416.61
7.4.240.0060.00116.58
7.4.230.0000.00716.44
7.4.220.0110.00616.70
7.4.210.0100.00416.62
7.4.200.0080.00016.56
7.4.190.0030.00316.50
7.4.160.0100.00716.80
7.4.150.0120.00617.40
7.4.140.0150.00517.86
7.4.130.0110.00516.62
7.4.120.0100.00916.63
7.4.110.0170.00616.64
7.4.100.0090.00916.57
7.4.90.0120.00616.79
7.4.80.0170.00319.39
7.4.70.0140.00916.79
7.4.60.0070.01416.60
7.4.50.0000.00416.64
7.4.40.0000.01422.77
7.4.30.0100.00716.59
7.4.00.0080.01014.91
7.3.330.0000.00613.43
7.3.320.0030.00313.27
7.3.310.0080.00016.48
7.3.300.0000.00816.44
7.3.290.0080.00616.45
7.3.280.0060.01316.40
7.3.270.0080.00917.40
7.3.260.0110.00516.41
7.3.250.0120.00616.61
7.3.240.0080.00816.55
7.3.230.0060.01016.39
7.3.210.0110.00716.48
7.3.200.0110.01119.39
7.3.190.0100.01316.50
7.3.180.0110.00416.45
7.3.170.0150.00416.68
7.3.160.0100.01016.44
7.3.120.0060.01015.04
7.3.110.0060.01014.93
7.3.100.0030.01114.88
7.3.90.0070.00715.04
7.3.80.0070.00714.70
7.3.70.0070.00714.92
7.3.60.0170.00014.91
7.3.50.0000.01514.70
7.3.40.0030.01014.82
7.3.30.0100.00714.86
7.3.20.0040.00416.64
7.3.10.0110.00216.66
7.3.00.0060.00616.73
7.2.330.0100.00716.66
7.2.320.0120.00616.81
7.2.310.0150.00316.83
7.2.300.0070.01116.85
7.2.290.0100.00716.66
7.2.250.0170.00314.74
7.2.240.0070.01415.32
7.2.230.0060.00915.00
7.2.220.0040.01115.17
7.2.210.0060.00915.21
7.2.200.0070.01115.15
7.2.190.0030.00614.89
7.2.180.0120.00415.26
7.2.170.0100.00715.15
7.2.130.0030.01016.72
7.2.120.0030.00616.56
7.2.110.0070.00716.49
7.2.100.0040.01416.87
7.2.90.0080.00416.64
7.2.80.0060.00916.69
7.2.70.0040.01116.95
7.2.60.0030.01216.76
7.2.50.0070.00716.78
7.2.40.0080.00416.52
7.2.30.0070.00416.59
7.2.20.0060.00316.79
7.2.10.0030.00916.52
7.2.00.0080.00317.95
7.1.330.0000.01515.89
7.1.320.0030.01015.85
7.1.310.0070.00716.11
7.1.300.0080.00515.92
7.1.290.0070.00715.74
7.1.280.0100.00615.82
7.1.270.0080.00815.70
7.1.260.0000.01315.60
7.1.250.0130.00315.35
7.1.200.0040.00815.81
7.1.100.0110.01718.23
7.1.70.0100.00717.09
7.1.60.0090.01519.46
7.1.50.0120.01216.83
7.1.00.0030.07722.45
7.0.200.0000.00916.50
7.0.140.0130.06322.09
7.0.110.0030.08319.93
7.0.100.0030.05020.08
7.0.90.0130.06020.10
7.0.80.0000.03720.07
7.0.70.0100.07719.95
7.0.60.0070.04719.95
7.0.50.0230.03319.88
7.0.40.0000.05319.76
7.0.30.0130.07019.88
7.0.20.0130.05319.84
7.0.10.0030.08019.73
7.0.00.0100.07019.85
5.6.280.0070.07021.14
5.6.260.0030.07720.67
5.6.250.0030.08720.62
5.6.240.0100.08020.56
5.6.230.0030.04720.47
5.6.220.0030.05720.68
5.6.210.0030.07020.68
5.6.200.0030.08020.57
5.6.190.0070.08320.69
5.6.180.0100.06320.61
5.6.170.0070.05020.63
5.6.160.0070.07720.69
5.6.150.0070.07720.84
5.6.140.0070.06320.61
5.6.130.0130.06720.55
5.6.120.0070.08320.46
5.6.110.0100.07320.64
5.6.100.0170.07320.64
5.6.90.0070.06020.69
5.6.80.0100.06720.02
5.6.70.0170.07019.92
5.6.60.0100.08019.88
5.6.50.0070.04320.02
5.6.40.0030.04719.92
5.6.30.0070.05019.99
5.6.20.0070.06720.20
5.6.10.0100.03719.98
5.6.00.0100.04019.94
5.5.380.0100.06717.69
5.5.370.0170.08317.70
5.5.360.0070.05017.53
5.5.350.0100.06317.54
5.5.340.0070.08017.91
5.5.330.0070.07718.10
5.5.320.0100.04317.91
5.5.310.0100.06318.07
5.5.300.0130.06718.22
5.5.290.0130.07018.05
5.5.280.0070.08018.12
5.5.270.0130.07018.09
5.5.260.0000.09318.09
5.5.250.0170.03717.88
5.5.240.0100.07317.34
5.5.230.0000.05317.47
5.5.220.0100.03717.28
5.5.210.0070.07717.30
5.5.200.0030.07717.31
5.5.190.0130.06717.58
5.5.180.0130.06717.42
5.5.160.0130.03717.32
5.5.150.0070.04317.57
5.5.140.0130.07317.59
5.5.130.0070.03717.43
5.5.120.0070.07317.27
5.5.110.0130.06717.43
5.5.100.0070.04717.48
5.5.90.0030.04017.30
5.5.80.0130.06717.17
5.5.70.0070.08017.18
5.5.60.0130.06717.16
5.5.50.0100.06717.38
5.5.40.0070.07717.15
5.5.30.0070.04317.37
5.5.20.0070.07317.48
5.5.10.0100.06717.36
5.5.00.0000.08017.16
5.4.450.0030.05019.27
5.4.440.0070.04719.66
5.4.430.0030.08319.27
5.4.420.0130.06719.46
5.4.410.0070.07319.41
5.4.400.0100.04019.00
5.4.390.0070.07719.17
5.4.380.0170.06318.95
5.4.370.0030.08018.98
5.4.360.0100.07318.95
5.4.350.0030.08319.14
5.4.340.0130.06719.00
5.4.320.0030.04719.14
5.4.310.0100.07319.32
5.4.300.0100.04318.97
5.4.290.0100.05319.03
5.4.280.0030.06019.01
5.4.270.0070.05019.01
5.4.260.0000.07719.24
5.4.250.0030.05319.31
5.4.240.0000.06019.04
5.4.230.0070.03719.31
5.4.220.0100.04719.16
5.4.210.0070.08318.97
5.4.200.0070.04018.99
5.4.190.0100.03318.98
5.4.180.0070.04019.30
5.4.170.0200.06319.13
5.4.160.0070.04719.00
5.4.150.0100.07718.98
5.4.140.0000.06716.58
5.4.130.0030.04316.37
5.4.120.0100.06716.43
5.4.110.0030.07716.64
5.4.100.0000.05716.46
5.4.90.0300.05016.63
5.4.80.0000.05016.61
5.4.70.0030.07316.50
5.4.60.0070.07016.53
5.4.50.0100.07016.38
5.4.40.0100.07716.43
5.4.30.0030.07716.42
5.4.20.0100.06716.54
5.4.10.0130.06716.46
5.4.00.0130.06315.78
5.3.290.0030.07714.67
5.3.280.0000.06314.68
5.3.270.0030.07714.70
5.3.260.0070.04314.62
5.3.250.0070.05714.75
5.3.240.0070.05314.48
5.3.230.0100.04714.60
5.3.220.0130.05314.59
5.3.210.0070.06014.72
5.3.200.0030.08014.70
5.3.190.0100.07714.80
5.3.180.0070.07314.71
5.3.170.0100.07314.58
5.3.160.0100.05014.54
5.3.150.0130.06714.59
5.3.140.0070.04314.58
5.3.130.0100.07014.57
5.3.120.0200.05014.63
5.3.110.0070.06714.68
5.3.100.0100.07013.90
5.3.90.0030.07314.11
5.3.80.0100.04314.13
5.3.70.0070.07314.15
5.3.60.0030.07014.02
5.3.50.0070.06714.09
5.3.40.0070.06313.93
5.3.30.0070.06014.04
5.3.20.0000.06013.70
5.3.10.0030.04713.75
5.3.00.0100.04013.66
5.2.170.0170.05012.15
5.2.160.0070.06012.15
5.2.150.0070.06312.15
5.2.140.0100.05712.15
5.2.130.0000.05312.15
5.2.120.0100.05312.15
5.2.110.0100.05012.15
5.2.100.0000.06312.15
5.2.90.0030.06012.15
5.2.80.0030.03312.15
5.2.70.0030.05012.15
5.2.60.0030.06312.15
5.2.50.0030.06712.15
5.2.40.0030.06012.15
5.2.30.0000.05712.15
5.2.20.0030.05712.15
5.2.10.0030.02312.15
5.2.00.0070.04712.15
5.1.60.0000.02712.15
5.1.50.0030.05012.15
5.1.40.0030.04012.15
5.1.30.0030.04312.15
5.1.20.0000.06012.15
5.1.10.0070.05312.15
5.1.00.0100.04012.15
5.0.50.0030.04712.15
5.0.40.0000.04712.15
5.0.30.0000.04712.15
5.0.20.0000.04312.15
5.0.10.0070.03312.15
5.0.00.0000.05012.15
4.4.90.0000.03312.15
4.4.80.0070.02712.15
4.4.70.0030.03712.15
4.4.60.0030.03312.15
4.4.50.0030.02712.15
4.4.40.0000.05712.15
4.4.30.0000.03712.15
4.4.20.0000.01712.15
4.4.10.0000.02312.15
4.4.00.0000.05712.15
4.3.110.0000.03312.15
4.3.100.0070.03012.15
4.3.90.0030.02012.15
4.3.80.0000.04712.15
4.3.70.0000.02312.15
4.3.60.0030.01712.15
4.3.50.0000.01712.15
4.3.40.0030.02312.15
4.3.30.0030.03012.15
4.3.20.0030.01312.15
4.3.10.0000.02312.15
4.3.00.0030.01312.15

preferences:
44.06 ms | 401 KiB | 5 Q