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('HERE n'); } //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.0040.01116.63
8.3.50.0090.00921.95
8.3.40.0100.00719.02
8.3.30.0110.00319.20
8.3.20.0090.00620.09
8.3.10.0000.00721.82
8.3.00.0160.00019.51
8.2.180.0070.00718.05
8.2.170.0100.01022.96
8.2.160.0120.00320.35
8.2.150.0050.00324.18
8.2.140.0030.00524.66
8.2.130.0120.00626.16
8.2.120.0000.00822.26
8.2.110.0080.00022.25
8.2.100.0030.00918.03
8.2.90.0040.00419.34
8.2.80.0000.00817.97
8.2.70.0030.00517.75
8.2.60.0030.00517.80
8.2.50.0030.00718.07
8.2.40.0050.00319.95
8.2.30.0030.00518.02
8.2.20.0000.00917.83
8.2.10.0080.00019.83
8.2.00.0030.00617.88
8.1.280.0070.01325.92
8.1.270.0050.00323.88
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0060.00323.84
8.1.230.0080.00319.10
8.1.220.0000.00817.74
8.1.210.0050.00318.77
8.1.200.0000.01017.35
8.1.190.0040.00417.40
8.1.180.0100.00018.89
8.1.170.0000.00818.59
8.1.160.0040.00422.09
8.1.150.0080.00318.68
8.1.140.0000.00717.39
8.1.130.0000.00717.95
8.1.120.0040.00417.43
8.1.110.0030.00717.50
8.1.100.0070.00017.48
8.1.90.0040.00417.45
8.1.80.0030.00317.35
8.1.70.0000.00717.50
8.1.60.0000.00817.61
8.1.50.0090.00017.54
8.1.40.0030.00517.57
8.1.30.0000.00817.63
8.1.20.0050.00217.59
8.1.10.0040.00417.50
8.1.00.0000.00717.53
8.0.300.0050.00218.77
8.0.290.0040.00417.16
8.0.280.0040.00418.38
8.0.270.0070.00017.27
8.0.260.0030.00317.29
8.0.250.0030.00317.05
8.0.240.0040.00416.91
8.0.230.0040.00416.93
8.0.220.0050.00216.87
8.0.210.0070.00016.87
8.0.200.0040.00417.05
8.0.190.0040.00417.05
8.0.180.0000.00717.01
8.0.170.0000.00816.87
8.0.160.0030.00517.00
8.0.150.0000.00716.87
8.0.140.0070.00017.00
8.0.130.0030.00613.37
8.0.120.0030.00516.89
8.0.110.0000.00716.91
8.0.100.0040.00416.80
8.0.90.0040.00416.86
8.0.80.0030.01816.95
8.0.70.0030.00516.96
8.0.60.0000.00816.80
8.0.50.0000.00816.97
8.0.30.0120.00617.16
8.0.20.0110.00817.40
8.0.10.0020.00516.98
8.0.00.0060.01116.85
7.4.330.0060.00015.05
7.4.320.0040.00416.61
7.4.300.0030.00316.54
7.4.290.0030.00316.52
7.4.280.0030.00316.53
7.4.270.0000.00716.55
7.4.260.0030.00316.60
7.4.250.0060.00316.51
7.4.240.0020.00516.63
7.4.230.0050.00316.65
7.4.220.0040.01816.58
7.4.210.0110.00516.51
7.4.200.0000.00716.52
7.4.190.0000.00716.45
7.4.160.0130.00316.54
7.4.150.0090.00917.40
7.4.140.0120.00617.86
7.4.130.0110.00716.64
7.4.120.0120.00816.59
7.4.110.0130.00616.46
7.4.100.0090.01016.51
7.4.90.0080.00816.50
7.4.80.0120.00819.39
7.4.70.0030.01316.70
7.4.60.0120.00916.58
7.4.50.0000.00816.49
7.4.40.0040.01122.77
7.4.30.0030.01316.50
7.4.00.0070.01015.10
7.3.330.0030.00313.52
7.3.320.0030.00313.44
7.3.310.0030.00316.43
7.3.300.0050.00316.38
7.3.290.0110.00616.41
7.3.280.0090.00916.41
7.3.270.0140.00417.40
7.3.260.0090.01316.47
7.3.250.0060.01216.59
7.3.240.0100.00716.58
7.3.230.0080.00916.39
7.3.210.0030.01416.70
7.3.200.0110.01319.39
7.3.190.0090.00916.48
7.3.180.0030.01316.58
7.3.170.0040.01116.53
7.3.160.0120.00916.38
7.3.120.0060.01014.91
7.3.110.0070.01015.12
7.3.100.0120.00314.92
7.3.90.0070.00314.95
7.3.80.0050.00514.65
7.3.70.0040.00414.77
7.3.60.0110.00415.04
7.3.50.0040.01114.63
7.3.40.0080.00814.88
7.3.30.0060.00314.88
7.3.20.0090.00316.60
7.3.10.0070.00716.64
7.3.00.0100.00616.74
7.2.330.0100.00816.85
7.2.320.0160.00416.55
7.2.310.0060.01016.47
7.2.300.0070.01116.73
7.2.290.0000.01716.88
7.2.250.0040.01515.15
7.2.240.0100.01015.13
7.2.230.0090.00615.15
7.2.220.0070.00715.09
7.2.210.0080.00814.93
7.2.200.0110.00415.13
7.2.190.0070.00414.95
7.2.180.0030.00715.07
7.2.170.0040.01115.25
7.2.00.0120.00319.52
7.1.330.0030.01015.66
7.1.320.0080.00515.89
7.1.310.0030.00715.80
7.1.300.0130.00315.84
7.1.290.0040.00815.95
7.1.280.0000.00915.82
7.1.270.0060.00615.87
7.1.260.0090.00616.00
7.1.200.0080.00915.40
7.1.100.0060.00618.43
7.1.70.0000.00717.30
7.1.60.0100.01419.46
7.1.50.0040.01916.70
7.1.00.0030.07722.40
7.0.200.0030.00516.85
7.0.140.0030.07322.12
7.0.60.0070.08719.96
7.0.50.0000.08717.88
7.0.40.0070.08720.25
7.0.30.0500.05020.23
7.0.20.0300.07720.24
7.0.10.0270.05020.08
7.0.00.0200.03020.20
5.6.280.0000.07321.04
5.6.210.0070.07320.62
5.6.200.0070.08718.18
5.6.190.0070.05720.39
5.6.180.0200.06320.63
5.6.170.0200.03720.40
5.6.160.0030.06020.52
5.6.150.0000.06018.18
5.6.140.0030.08018.24
5.6.130.0130.04718.27
5.6.120.0130.03721.00
5.6.110.0130.07721.00
5.6.100.0100.03321.05
5.6.90.0070.09020.98
5.6.80.0000.04720.43
5.6.70.0270.04720.53
5.5.350.0030.07720.44
5.5.340.0070.04718.04
5.5.330.0070.04020.40
5.5.320.0300.04320.30
5.5.310.0130.04320.33
5.5.300.0000.04017.98
5.5.290.0030.04317.96
5.5.280.0070.09020.81
5.5.270.0130.07320.87
5.5.260.0070.03720.77
5.5.250.0100.08720.65
5.5.240.0100.06320.29
5.4.450.0800.05719.48
5.4.440.0970.05719.20
5.4.430.0800.06719.37
5.4.420.0730.06319.44
5.4.410.0770.06319.03
5.4.400.0730.05319.07
5.4.390.0970.04719.14
5.4.380.0330.05318.50
5.4.370.0170.06018.72
5.4.360.0230.06018.89
5.4.350.0570.06018.63
5.4.340.0370.05718.77
5.4.320.0090.04412.51
5.4.310.0050.04412.51
5.4.300.0100.03812.51
5.4.290.0080.04612.49
5.4.280.0080.03912.39
5.4.270.0090.06312.39
5.4.260.0090.04512.39
5.4.250.0050.04312.39
5.4.240.0090.04912.38
5.4.230.0100.04712.38
5.4.220.0120.04812.38
5.4.210.0040.04312.38
5.4.200.0160.07912.38
5.4.190.0090.06812.38
5.4.180.0070.06512.38
5.4.170.0110.05112.38
5.4.160.0130.09112.38
5.4.150.0140.06612.38
5.4.140.0160.04712.06
5.4.130.0070.05612.05
5.4.120.0210.06212.01
5.4.110.0150.07312.01
5.4.100.0060.05212.00
5.4.90.0180.06012.01
5.4.80.0110.06912.01
5.4.70.0060.05912.00
5.4.60.0110.05812.00
5.4.50.0070.05512.00
5.4.40.0100.05511.99
5.4.30.0100.05211.98
5.4.20.0100.06311.98
5.4.10.0140.06011.98
5.4.00.0060.06111.47
5.3.290.0050.03912.80
5.3.280.0140.05112.71
5.3.270.0140.05612.72
5.3.260.0090.07012.72
5.3.250.0090.05912.71
5.3.240.0100.05012.72
5.3.230.0090.04912.71
5.3.220.0060.03712.68
5.3.210.0070.04712.68
5.3.200.0090.05312.68
5.3.190.0090.05012.68
5.3.180.0070.04012.67
5.3.170.0060.03812.67
5.3.160.0020.04212.67
5.3.150.0090.05212.67
5.3.140.0080.05012.66
5.3.130.0080.04712.66
5.3.120.0070.03712.65
5.3.110.0050.04812.66
5.3.100.0070.04212.13
5.3.90.0040.03912.11
5.3.80.0060.04212.10
5.3.70.0100.04012.10
5.3.60.0060.03812.08
5.3.50.0040.03912.04
5.3.40.0050.03812.03
5.3.30.0090.03311.99
5.3.20.0050.03811.77
5.3.10.0050.03911.74
5.3.00.0090.03511.73
5.2.170.0070.0299.23
5.2.160.0080.0279.23
5.2.150.0070.0299.23
5.2.140.0050.0349.23
5.2.130.0080.0369.19
5.2.120.0080.0409.18
5.2.110.0080.0369.19
5.2.100.0080.0379.19
5.2.90.0080.0319.19
5.2.80.0080.0289.18
5.2.70.0080.0289.18
5.2.60.0100.0439.14
5.2.50.0120.0459.11
5.2.40.0040.0329.08
5.2.30.0050.0429.06
5.2.20.0070.0419.04
5.2.10.0070.0578.95
5.2.00.0130.0378.82
5.1.60.0050.0388.10
5.1.50.0090.0328.09
5.1.40.0060.0388.08
5.1.30.0080.0348.43
5.1.20.0110.0368.45
5.1.10.0040.0308.17
5.1.00.0060.0248.17
5.0.50.0040.0266.65
5.0.40.0050.0186.51
5.0.30.0040.0326.32
5.0.20.0040.0206.30
5.0.10.0050.0236.28
5.0.00.0040.0326.27
4.4.90.0060.0124.78
4.4.80.0040.0144.75
4.4.70.0040.0154.76
4.4.60.0040.0154.75
4.4.50.0000.0194.77
4.4.40.0030.0254.71
4.4.30.0040.0154.76
4.4.20.0020.0174.84
4.4.10.0020.0174.85
4.4.00.0010.0284.76
4.3.110.0050.0234.67
4.3.100.0050.0184.66
4.3.90.0060.0144.63
4.3.80.0040.0254.58
4.3.70.0020.0194.63
4.3.60.0020.0174.63
4.3.50.0030.0164.63
4.3.40.0020.0264.54
4.3.30.0020.0163.30
4.3.20.0040.0153.28
4.3.10.0030.0213.24
4.3.00.0170.01710.54

preferences:
39.63 ms | 401 KiB | 5 Q