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; public $testy; final public function run() { call_user_func($this->callback); die('here'.$this->testy); 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($k); if($k == 'Testsecret') { die('dedade'); } //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.0090.00616.63
8.3.60.0090.00616.50
8.3.50.0230.00821.99
8.3.40.0110.00719.00
8.3.30.0110.00419.22
8.3.20.0040.00420.13
8.3.10.0080.00021.82
8.3.00.0040.00419.50
8.2.180.0080.00818.29
8.2.170.0110.00722.96
8.2.160.0100.00320.35
8.2.150.0130.00624.18
8.2.140.0060.00324.66
8.2.130.0070.01026.16
8.2.120.0000.00722.25
8.2.110.0000.01020.35
8.2.100.0060.00617.84
8.2.90.0050.00319.27
8.2.80.0090.00017.97
8.2.70.0000.00817.38
8.2.60.0070.00418.18
8.2.50.0000.01218.07
8.2.40.0000.00920.00
8.2.30.0070.00018.22
8.2.20.0000.00717.76
8.2.10.0000.00818.15
8.2.00.0000.01117.74
8.1.280.0040.01125.92
8.1.270.0050.00324.02
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0040.01823.93
8.1.230.0120.00024.06
8.1.220.0050.00317.74
8.1.210.0040.00418.77
8.1.200.0030.00617.13
8.1.190.0000.00717.65
8.1.180.0000.00919.01
8.1.170.0040.00418.53
8.1.160.0040.00421.96
8.1.150.0000.00918.58
8.1.140.0000.00717.54
8.1.130.0070.00017.77
8.1.120.0000.00717.54
8.1.110.0000.00817.40
8.1.100.0060.00317.48
8.1.90.0040.00417.49
8.1.80.0070.00017.51
8.1.70.0000.00717.45
8.1.60.0040.00417.60
8.1.50.0090.00017.55
8.1.40.0040.00417.55
8.1.30.0040.00417.61
8.1.20.0000.00817.59
8.1.10.0040.00417.50
8.1.00.0030.00517.53
8.0.300.0050.00218.77
8.0.290.0000.00717.18
8.0.280.0030.00318.54
8.0.270.0030.00317.29
8.0.260.0030.00317.25
8.0.250.0030.00517.04
8.0.240.0030.00616.96
8.0.230.0030.00316.93
8.0.220.0070.00016.99
8.0.210.0070.00016.97
8.0.200.0040.00417.06
8.0.190.0030.00516.98
8.0.180.0040.00417.02
8.0.170.0000.00716.86
8.0.160.0070.00016.95
8.0.150.0040.00416.92
8.0.140.0050.00316.83
8.0.130.0000.00713.38
8.0.120.0000.00816.93
8.0.110.0050.00217.04
8.0.100.0040.00416.89
8.0.90.0000.00816.81
8.0.80.0180.00417.04
8.0.70.0000.00716.77
8.0.60.0000.00916.90
8.0.50.0020.00516.85
8.0.30.0120.00917.14
8.0.20.0120.00917.40
8.0.10.0000.00817.04
8.0.00.0110.00616.68
7.4.330.0050.00015.00
7.4.320.0030.00316.67
7.4.300.0000.00716.63
7.4.290.0040.00416.58
7.4.280.0000.00716.63
7.4.270.0040.00416.52
7.4.260.0000.00716.53
7.4.250.0040.00416.49
7.4.240.0050.00216.55
7.4.230.0000.00716.66
7.4.220.0110.01116.55
7.4.210.0060.00816.65
7.4.200.0070.00016.75
7.4.190.0000.00716.61
7.4.160.0080.00816.52
7.4.150.0100.01017.40
7.4.140.0100.01017.86
7.4.130.0030.01516.45
7.4.120.0090.00916.64
7.4.110.0130.00316.46
7.4.100.0120.00616.56
7.4.90.0070.01016.55
7.4.80.0070.01419.39
7.4.70.0070.01116.60
7.4.60.0060.01216.52
7.4.50.0050.00016.33
7.4.40.0070.01022.77
7.4.30.0040.01416.69
7.4.00.0000.01715.20
7.3.330.0000.00613.43
7.3.320.0000.00613.51
7.3.310.0070.00016.48
7.3.300.0050.00316.54
7.3.290.0070.01016.46
7.3.280.0070.01216.47
7.3.270.0200.00417.40
7.3.260.0070.01016.48
7.3.250.0070.01016.47
7.3.240.0100.00716.50
7.3.230.0100.00716.40
7.3.210.0130.00316.65
7.3.200.0060.01219.39
7.3.190.0030.01916.54
7.3.180.0160.00016.43
7.3.170.0030.01416.45
7.3.160.0110.00516.45
7.3.120.0030.01314.96
7.3.10.0130.00316.78
7.3.00.0060.00916.61
7.2.330.0100.00716.70
7.2.320.0100.00716.52
7.2.310.0060.01216.69
7.2.300.0090.00616.63
7.2.290.0030.01316.82
7.2.130.0150.00016.98
7.2.120.0060.00916.84
7.2.110.0140.00316.72
7.2.100.0090.00617.02
7.2.90.0140.00317.13
7.2.80.0140.00017.00
7.2.70.0060.00917.20
7.2.60.0150.00216.84
7.2.50.0070.00716.91
7.2.40.0140.00716.98
7.2.30.0100.00316.69
7.2.20.0160.00616.59
7.2.10.0060.01016.95
7.2.00.0080.00618.05
7.1.250.0030.00715.79
7.1.100.0080.00418.28
7.1.70.0040.01116.93
7.1.60.0130.01319.46
7.1.50.0070.01516.95
7.1.00.0070.07322.37
7.0.200.0060.00316.75
7.0.140.0000.07721.92
7.0.60.0130.06019.80
7.0.50.0070.05317.88
7.0.40.0070.04020.06
7.0.30.0570.06020.26
7.0.20.0230.04020.05
7.0.10.0170.07720.23
7.0.00.0000.04720.12
5.6.280.0070.07020.79
5.6.210.0170.04720.70
5.6.200.0100.04718.27
5.6.190.0070.04720.34
5.6.180.0230.03720.55
5.6.170.0170.04320.58
5.6.160.0070.05020.39
5.6.150.0070.08018.26
5.6.140.0030.04318.15
5.6.130.0070.08318.16
5.6.120.0000.04721.06
5.6.110.0100.07321.03
5.6.100.0130.08721.09
5.6.90.0030.09021.13
5.6.80.0100.08020.38
5.6.70.3300.03320.54
5.5.350.0270.07720.39
5.5.340.0130.06318.05
5.5.330.0070.08720.43
5.5.320.0170.07320.27
5.5.310.0270.07320.30
5.5.300.0100.07717.98
5.5.290.0070.04718.05
5.5.280.0070.06020.80
5.5.270.0070.08720.88
5.5.260.0130.05720.65
5.5.250.0170.07020.59
5.5.240.3770.03020.36
5.4.450.0770.05319.63
5.4.440.0730.05319.18
5.4.430.0100.05319.36
5.4.420.1030.05719.15
5.4.410.0700.05319.32
5.4.400.0470.07019.34
5.4.390.0730.07319.12
5.4.380.0430.05018.57
5.4.370.0300.04718.70
5.4.360.0300.05318.73
5.4.350.0400.05318.63
5.4.340.0500.06318.70
5.4.320.0070.03912.50
5.4.310.0040.04112.51
5.4.300.0070.03612.51
5.4.290.0020.04612.49
5.4.280.0050.04012.39
5.4.270.0050.04012.39
5.4.260.0070.03712.39
5.4.250.0070.03712.38
5.4.240.0060.03712.39
5.4.230.0030.04012.38
5.4.220.0050.03712.38
5.4.210.0030.04112.38
5.4.200.0090.03412.38
5.4.190.0040.03912.38
5.4.180.0070.03512.37
5.4.170.0140.06912.39
5.4.160.0220.12312.38
5.4.150.0060.05612.38
5.4.140.0150.11512.06
5.4.130.0090.05412.05
5.4.120.0050.03912.01
5.4.110.0060.04612.00
5.4.100.0140.05612.01
5.4.90.0120.04712.00
5.4.80.0090.05012.00
5.4.70.0120.04512.00
5.4.60.0120.07312.00
5.4.50.0060.04812.00
5.4.40.0140.07011.98
5.4.30.0100.06211.98
5.4.20.0100.05911.98
5.4.10.0080.04211.98
5.4.00.0070.04011.48
5.3.290.0090.04212.80
5.3.280.0050.04512.71
5.3.270.0090.04512.72
5.3.260.0040.04712.72
5.3.250.0060.04012.72
5.3.240.0050.04712.72
5.3.230.0100.05712.71
5.3.220.0060.04112.68
5.3.210.0080.03812.68
5.3.200.0040.03812.68
5.3.190.0070.03712.67
5.3.180.0090.03512.67
5.3.170.0110.05112.67
5.3.160.0110.04812.67
5.3.150.0030.06212.67
5.3.140.0100.03712.66
5.3.130.0070.05612.66
5.3.120.0060.05912.66
5.3.110.0110.06412.66
5.3.100.0090.05212.13
5.3.90.0070.06012.11
5.3.80.0100.04912.10
5.3.70.0080.05012.11
5.3.60.0090.04912.09
5.3.50.0090.05212.04
5.3.40.0040.05112.04
5.3.30.0080.04211.99
5.3.20.0040.04011.77
5.3.10.0040.03811.74
5.3.00.0030.04011.73
5.2.170.0050.0309.23
5.2.160.0050.0309.23
5.2.150.0070.0299.23
5.2.140.0070.0299.23
5.2.130.0040.0309.19
5.2.120.0060.0289.19
5.2.110.0030.0339.20
5.2.100.0040.0389.20
5.2.90.0060.0409.20
5.2.80.0060.0309.18
5.2.70.0070.0409.19
5.2.60.0050.0429.14
5.2.50.0060.0419.11
5.2.40.0050.0399.09
5.2.30.0140.0389.07
5.2.20.0030.0429.05
5.2.10.0060.0398.96
5.2.00.0040.0428.82
5.1.60.0030.0368.10
5.1.50.0050.0318.10
5.1.40.0050.0358.08
5.1.30.0050.0368.43
5.1.20.0050.0358.45
5.1.10.0030.0288.18
5.1.00.0080.0348.18
5.0.50.0070.0256.66
5.0.40.0030.0296.52
5.0.30.0030.0456.33
5.0.20.0050.0296.30
5.0.10.0080.0256.28
5.0.00.0070.0376.27
4.4.90.0070.0194.78
4.4.80.0040.0204.75
4.4.70.0030.0224.75
4.4.60.0040.0204.75
4.4.50.0030.0304.77
4.4.40.0060.0364.71
4.4.30.0060.0194.76
4.4.20.0030.0224.84
4.4.10.0060.0194.85
4.4.00.0050.0264.76
4.3.110.0030.0164.67
4.3.100.0020.0164.66
4.3.90.0020.0164.64
4.3.80.0030.0254.58
4.3.70.0020.0164.63
4.3.60.0030.0154.63
4.3.50.0060.0134.63
4.3.40.0030.0254.54
4.3.30.0010.0173.30
4.3.20.0020.0173.28
4.3.10.0020.0163.24
4.3.00.0270.02010.54

preferences:
38.59 ms | 401 KiB | 5 Q