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.0150.00716.50
8.3.50.0140.00522.08
8.3.40.0030.01418.64
8.3.30.0140.00019.22
8.3.20.0070.00720.34
8.3.10.0030.00521.69
8.3.00.0030.01219.20
8.2.180.0110.00418.42
8.2.170.0070.00722.96
8.2.160.0140.00420.52
8.2.150.0040.00424.18
8.2.140.0040.01124.66
8.2.130.0080.00626.16
8.2.120.0070.00022.13
8.2.110.0100.00722.08
8.2.100.0070.00717.97
8.2.90.0060.00319.29
8.2.80.0040.00418.16
8.2.70.0030.00617.63
8.2.60.0040.00417.93
8.2.50.0100.00018.07
8.2.40.0040.00419.79
8.2.30.0040.00418.07
8.2.20.0040.00417.71
8.2.10.0030.00618.02
8.2.00.0070.00317.83
8.1.280.0120.00625.92
8.1.270.0090.00023.91
8.1.260.0040.00426.35
8.1.250.0030.00528.09
8.1.240.0070.00318.91
8.1.230.0100.00318.97
8.1.220.0050.00317.74
8.1.210.0080.00018.77
8.1.200.0030.00617.35
8.1.190.0040.00417.41
8.1.180.0100.00018.10
8.1.170.0030.00518.64
8.1.160.0000.00822.10
8.1.150.0040.00418.63
8.1.140.0040.00417.48
8.1.130.0030.00317.82
8.1.120.0030.00617.54
8.1.110.0040.00817.52
8.1.100.0050.00217.50
8.1.90.0050.00217.50
8.1.80.0030.00317.38
8.1.70.0040.00417.47
8.1.60.0050.00317.59
8.1.50.0050.00317.55
8.1.40.0080.00017.45
8.1.30.0080.00017.66
8.1.20.0040.00417.69
8.1.10.0040.00417.63
8.1.00.0070.00017.45
8.0.300.0050.00318.77
8.0.290.0040.00417.18
8.0.280.0000.00718.37
8.0.270.0040.00417.19
8.0.260.0040.00417.21
8.0.250.0000.00717.06
8.0.240.0000.00817.09
8.0.230.0040.00417.05
8.0.220.0050.00316.98
8.0.210.0030.00317.00
8.0.200.0040.00416.93
8.0.190.0040.00417.04
8.0.180.0040.00417.06
8.0.170.0000.00717.01
8.0.160.0000.00716.94
8.0.150.0040.00416.94
8.0.140.0040.00416.91
8.0.130.0050.00213.45
8.0.120.0000.00716.84
8.0.110.0040.00416.88
8.0.100.0040.00416.92
8.0.90.0050.00216.99
8.0.80.0030.01416.86
8.0.70.0000.00717.07
8.0.60.0040.00416.93
8.0.50.0080.00017.09
8.0.30.0100.00817.19
8.0.20.0130.00617.45
8.0.10.0050.00217.06
8.0.00.0150.00516.85
7.4.330.0000.00615.12
7.4.320.0000.00716.52
7.4.300.0000.00716.63
7.4.290.0070.00016.62
7.4.280.0030.00316.63
7.4.270.0030.00316.54
7.4.260.0030.00316.62
7.4.250.0080.00016.57
7.4.240.0040.00316.49
7.4.230.0050.00216.68
7.4.220.0160.00316.57
7.4.210.0060.01116.63
7.4.200.0000.00816.46
7.4.190.0040.00416.77
7.4.160.0110.00416.58
7.4.150.0070.01017.40
7.4.140.0080.01217.86
7.4.130.0050.01316.51
7.4.120.0120.00416.53
7.4.110.0100.01316.64
7.4.100.0120.00616.47
7.4.90.0140.00316.72
7.4.80.0100.00719.39
7.4.70.0070.01016.38
7.4.60.0140.00516.57
7.4.50.0030.00316.37
7.4.40.0080.00322.77
7.4.30.0040.01216.45
7.4.10.0030.01415.15
7.4.00.0070.01014.97
7.3.330.0000.00613.35
7.3.320.0050.00013.41
7.3.310.0070.00016.38
7.3.300.0020.00516.38
7.3.290.0030.01316.41
7.3.280.0120.00616.45
7.3.270.0100.01417.40
7.3.260.0060.01216.38
7.3.250.0100.01216.54
7.3.240.0090.00916.52
7.3.230.0090.00916.50
7.3.210.0130.00316.64
7.3.200.0190.00519.39
7.3.190.0090.00916.61
7.3.180.0030.01216.50
7.3.170.0060.01016.59
7.3.160.0070.01416.50
7.3.130.0040.01114.57
7.3.120.0100.00814.94
7.3.110.0080.00914.87
7.3.100.0030.01114.82
7.3.90.0080.00614.91
7.3.80.0050.01014.82
7.3.70.0050.00714.91
7.3.60.0050.00914.87
7.3.50.0060.00814.72
7.3.40.0080.00714.79
7.3.30.0070.00614.91
7.3.20.0050.00916.59
7.3.10.0060.00716.71
7.3.00.0060.00716.68
7.2.330.0110.00616.48
7.2.320.0140.00616.71
7.2.310.0070.01416.43
7.2.300.0090.00916.70
7.2.290.0140.00716.82
7.2.260.0070.01315.22
7.2.250.0060.01215.25
7.2.240.0070.01115.20
7.2.230.0070.00714.98
7.2.220.0070.00615.02
7.2.210.0050.01115.06
7.2.200.0060.00915.07
7.2.190.0080.00814.95
7.2.180.0100.00615.00
7.2.170.0050.00715.08
7.2.160.0060.00914.80
7.2.150.0090.00616.81
7.2.140.0090.00316.86
7.2.130.0060.00716.80
7.2.120.0080.00517.05
7.2.110.0030.01016.88
7.2.100.0090.00316.92
7.2.90.0080.00716.90
7.2.80.0030.01016.72
7.2.70.0030.00816.92
7.2.60.0060.00616.97
7.2.50.0050.01016.82
7.2.40.0080.00517.03
7.2.30.0090.00617.07
7.2.20.0070.00716.96
7.2.10.0050.00716.88
7.2.00.0040.00817.74
7.1.330.0080.00715.79
7.1.320.0040.00915.75
7.1.310.0060.00615.67
7.1.300.0070.00615.73
7.1.290.0070.00815.85
7.1.280.0040.00715.68
7.1.270.0080.00515.81
7.1.260.0040.00915.80
7.1.250.0050.00615.86
7.1.240.0060.00316.05
7.1.230.0080.00615.85
7.1.220.0000.00815.74
7.1.210.0030.00615.93
7.1.200.0060.00615.98
7.1.190.0060.00616.00
7.1.180.0030.01015.83
7.1.170.0110.00315.73
7.1.160.0000.01415.76
7.1.150.0080.00415.63
7.1.140.0040.01115.80
7.1.130.0040.00815.68
7.1.120.0040.00815.94
7.1.110.0090.00015.72
7.1.100.0050.00916.80
7.1.90.0030.01015.45
7.1.80.0060.00915.58
7.1.70.0080.00216.45
7.1.60.0050.01417.72
7.1.50.0040.00616.24
7.1.40.0030.01015.60
7.1.30.0040.00815.89
7.1.20.0070.00715.75
7.1.10.0090.00315.54
7.1.00.0030.04419.04
7.0.330.0080.00415.26
7.0.320.0030.00615.46
7.0.310.0030.00915.38
7.0.300.0030.01015.54
7.0.290.0120.00315.46
7.0.280.0060.00315.52
7.0.270.0070.01015.47
7.0.260.0040.00715.50
7.0.250.0060.00315.42
7.0.240.0060.00615.59
7.0.230.0060.00615.52
7.0.220.0050.00315.21
7.0.210.0030.01015.40
7.0.200.0020.00716.00
7.0.190.0030.00915.38
7.0.180.0040.00415.46
7.0.170.0040.01115.44
7.0.160.0000.00815.55
7.0.150.0070.00715.41
7.0.140.0030.04118.73
7.0.130.0070.00315.25
7.0.120.0000.00815.38
7.0.110.0060.00615.61
7.0.100.0060.00615.63
7.0.90.0070.00315.43
7.0.80.0040.00815.48
7.0.70.0040.00815.09
7.0.60.0080.04217.60
7.0.50.0080.02016.69
7.0.40.0080.02516.94
7.0.30.0240.02516.87
7.0.20.0110.03316.90
7.0.10.0100.03516.84
7.0.00.0050.03116.90
5.6.400.0070.00314.76
5.6.390.0090.00314.11
5.6.380.0000.00914.77
5.6.370.0040.01114.50
5.6.360.0030.00614.45
5.6.350.0090.00614.03
5.6.340.0000.01214.25
5.6.330.0030.00614.59
5.6.320.0100.00314.13
5.6.310.0030.01014.70
5.6.300.0090.00614.63
5.6.290.0000.01014.25
5.6.280.0050.03817.74
5.6.270.0070.00714.18
5.6.260.0030.01314.55
5.6.250.0070.00714.58
5.6.240.0000.00914.54
5.6.230.0060.00614.48
5.6.220.0080.00014.41
5.6.210.0050.03917.55
5.6.200.0090.03916.38
5.6.190.0060.03417.54
5.6.180.0120.02617.58
5.6.170.0130.04317.41
5.6.160.0060.04317.45
5.6.150.0070.04016.24
5.6.140.0110.01716.45
5.6.130.0050.02516.27
5.6.120.0080.04617.75
5.6.110.0040.02417.75
5.6.100.0030.04717.61
5.6.90.0050.02417.78
5.6.80.0150.03617.48
5.6.70.0030.00614.54
5.6.60.0040.00714.21
5.6.50.0000.00914.35
5.6.40.0140.00014.27
5.6.30.0070.00614.43
5.6.20.0070.00714.63
5.6.10.0030.01014.39
5.6.00.0030.01014.33
5.5.380.0120.00414.32
5.5.370.0090.00614.39
5.5.360.0060.00614.37
5.5.350.0150.03317.53
5.5.340.0070.03016.24
5.5.330.0120.04317.51
5.5.320.0160.02817.39
5.5.310.0100.02817.36
5.5.300.0060.04516.25
5.5.290.0080.02816.18
5.5.280.0060.04617.72
5.5.270.0100.03817.63
5.5.260.0090.04517.62
5.5.250.0030.03617.40
5.5.240.2110.02717.22
5.5.230.0110.00814.43
5.5.220.0070.00714.18
5.5.210.0030.01014.32
5.5.200.0030.00714.20
5.5.190.0060.01014.11
5.5.180.0100.00314.50
5.5.170.0090.00614.60
5.5.160.0060.00714.20
5.5.150.0000.01614.55
5.5.140.0040.00814.48
5.5.130.0080.00414.47
5.5.120.0070.00714.71
5.5.110.0090.00014.39
5.5.100.0070.00414.38
5.5.90.0160.00014.30
5.5.80.0090.00914.57
5.5.70.0030.01014.42
5.5.60.0040.00414.50
5.5.50.0100.00614.41
5.5.40.0030.01614.27
5.5.30.0100.00314.25
5.5.20.0030.01514.42
5.5.10.0040.00414.20
5.5.00.0110.00414.20
5.4.450.0350.03616.64
5.4.440.0210.03116.64
5.4.430.0420.03216.54
5.4.420.0430.02816.49
5.4.410.0110.02516.50
5.4.400.0470.02316.38
5.4.390.0070.03016.43
5.4.380.0080.03216.12
5.4.370.0150.03016.16
5.4.360.0120.03016.20
5.4.350.0120.03516.04
5.4.340.0180.03016.17
5.4.330.0100.00013.61
5.4.320.0040.02413.06
5.4.310.0040.02413.06
5.4.300.0040.02213.06
5.4.290.0090.02413.05
5.4.280.0070.02213.00
5.4.270.0050.02413.00
5.4.260.0040.02913.00
5.4.250.0100.02913.00
5.4.240.0070.02313.00
5.4.230.0020.02612.99
5.4.220.0070.02012.99
5.4.210.0060.02513.00
5.4.200.0060.02012.99
5.4.190.0070.02212.99
5.4.180.0110.02012.99
5.4.170.0050.02213.00
5.4.160.0020.02613.00
5.4.150.0080.02613.00
5.4.140.0050.02412.84
5.4.130.0040.02512.83
5.4.120.0050.02512.81
5.4.110.0060.02212.81
5.4.100.0050.02812.81
5.4.90.0070.02412.81
5.4.80.0040.02412.81
5.4.70.0050.02212.81
5.4.60.0040.02512.81
5.4.50.0060.02112.80
5.4.40.0040.02312.80
5.4.30.0080.02412.80
5.4.20.0020.02612.80
5.4.10.0040.03012.80
5.4.00.0050.02412.54
5.3.290.0050.02713.21
5.3.280.0030.02713.16
5.3.270.0040.02413.17
5.3.260.0070.02213.17
5.3.250.0060.02513.17
5.3.240.0030.02613.17
5.3.230.0060.03113.16
5.3.220.0150.05613.15
5.3.210.0120.08013.15
5.3.200.0060.03313.14
5.3.190.0060.02913.15
5.3.180.0040.02913.14
5.3.170.0100.02813.14
5.3.160.0060.03213.14
5.3.150.0080.02613.14
5.3.140.0070.02713.14
5.3.130.0050.03513.13
5.3.120.0090.02913.13
5.3.110.0070.03013.14
5.3.100.0070.02712.87
5.3.90.0020.03412.86
5.3.80.0050.03112.86
5.3.70.0040.03112.86
5.3.60.0040.03112.85
5.3.50.0090.02612.82
5.3.40.0070.04112.82
5.3.30.0110.04112.80
5.3.20.0080.02312.69
5.3.10.0090.02212.68
5.3.00.0050.03012.67
5.2.170.0050.0459.23
5.2.160.0060.0459.23
5.2.150.0080.0319.23
5.2.140.0040.0339.23
5.2.130.0100.0519.19
5.2.120.0090.0619.19
5.2.110.0160.0559.19
5.2.100.0090.0429.19
5.2.90.0050.0429.19
5.2.80.0070.0489.18
5.2.70.0060.0429.18
5.2.60.0060.0439.14
5.2.50.0100.0609.11
5.2.40.0180.0849.09
5.2.30.0100.0669.06
5.2.20.0100.0489.04
5.2.10.0100.0478.95
5.2.00.0090.0498.82
5.1.60.0090.0338.10
5.1.50.0070.0328.09
5.1.40.0110.0318.08
5.1.30.0060.0388.43
5.1.20.0080.0378.45
5.1.10.0080.0358.18
5.1.00.0040.0368.18
5.0.50.0020.0256.65
5.0.40.0030.0226.52
5.0.30.0050.0376.32
5.0.20.0020.0216.29
5.0.10.0020.0216.27
5.0.00.0030.0356.27
4.4.90.0040.0224.78
4.4.80.0040.0284.76
4.4.70.0040.0164.76
4.4.60.0020.0204.75
4.4.50.0030.0204.77
4.4.40.0030.0354.71
4.4.30.0020.0204.76
4.4.20.0020.0174.84
4.4.10.0030.0244.85
4.4.00.0030.0344.76
4.3.110.0020.0244.67
4.3.100.0070.0124.66
4.3.90.0040.0154.64
4.3.80.0040.0274.58
4.3.70.0040.0174.63
4.3.60.0030.0144.63
4.3.50.0030.0164.63
4.3.40.0040.0264.54
4.3.30.0040.0213.30
4.3.20.0040.0203.28
4.3.10.0030.0213.24
4.3.00.0000.03010.54

preferences:
44.02 ms | 401 KiB | 5 Q