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($v == '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.74
8.3.50.0160.00322.10
8.3.40.0120.00618.84
8.3.30.0060.00919.07
8.3.20.0000.00720.16
8.3.10.0040.00421.96
8.3.00.0050.00319.38
8.2.180.0140.00417.00
8.2.170.0130.00322.96
8.2.160.0130.00320.52
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0000.00826.16
8.2.120.0050.00322.16
8.2.110.0060.00322.01
8.2.100.0000.01117.97
8.2.90.0040.00419.05
8.2.80.0000.00818.04
8.2.70.0040.00417.63
8.2.60.0050.00318.03
8.2.50.0030.00618.07
8.2.40.0030.00620.07
8.2.30.0000.00718.07
8.2.20.0040.00417.79
8.2.10.0000.00818.21
8.2.00.0060.00617.94
8.1.280.0100.00725.92
8.1.270.0030.00523.88
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0050.00523.91
8.1.230.0040.00719.08
8.1.220.0050.00317.74
8.1.210.0050.00318.77
8.1.200.0060.00317.47
8.1.190.0090.00017.63
8.1.180.0060.00318.96
8.1.170.0080.00018.51
8.1.160.0000.00722.11
8.1.150.0060.00318.63
8.1.140.0040.00417.43
8.1.130.0000.00717.76
8.1.120.0000.00717.39
8.1.110.0030.00717.50
8.1.100.0000.00717.49
8.1.90.0000.00717.45
8.1.80.0030.00317.49
8.1.70.0030.00517.42
8.1.60.0040.00417.61
8.1.50.0040.00417.53
8.1.40.0030.00617.57
8.1.30.0040.00417.48
8.1.20.0050.00317.69
8.1.10.0030.00617.56
8.1.00.0080.00017.53
8.0.300.0030.00518.77
8.0.290.0000.00817.04
8.0.280.0030.00518.52
8.0.270.0000.00717.16
8.0.260.0050.00317.29
8.0.250.0070.00017.00
8.0.240.0040.00417.09
8.0.230.0000.00716.95
8.0.220.0000.00717.00
8.0.210.0030.00316.95
8.0.200.0040.00416.95
8.0.190.0000.00816.95
8.0.180.0070.00017.06
8.0.170.0040.00416.90
8.0.160.0050.00216.98
8.0.150.0000.00716.76
8.0.140.0040.00416.88
8.0.130.0070.00013.47
8.0.120.0000.00716.87
8.0.110.0040.00416.94
8.0.100.0040.00416.95
8.0.90.0040.00416.87
8.0.80.0110.00416.86
8.0.70.0000.00817.02
8.0.60.0000.00816.88
8.0.50.0000.00816.87
8.0.30.0110.00816.97
8.0.20.0120.00917.40
8.0.10.0040.00417.14
8.0.00.0070.01216.83
7.4.330.0060.00015.08
7.4.320.0030.00316.43
7.4.300.0060.00016.52
7.4.290.0040.00416.53
7.4.280.0030.00516.52
7.4.270.0000.00716.44
7.4.260.0000.00716.53
7.4.250.0000.00816.52
7.4.240.0010.00616.54
7.4.230.0050.00216.67
7.4.220.0100.00716.48
7.4.210.0110.00816.63
7.4.200.0050.00316.57
7.4.190.0000.00716.79
7.4.160.0030.01316.71
7.4.150.0070.01017.40
7.4.140.0070.01217.86
7.4.130.0170.00016.53
7.4.120.0120.00716.59
7.4.110.0140.00316.41
7.4.100.0120.00616.63
7.4.90.0110.00616.71
7.4.80.0110.00919.39
7.4.70.0090.00916.66
7.4.60.0090.00816.35
7.4.50.0050.00316.60
7.4.40.0070.01022.77
7.4.30.0070.01016.30
7.4.00.0070.01014.93
7.3.330.0000.00613.45
7.3.320.0000.00513.45
7.3.310.0000.00716.29
7.3.300.0040.00416.43
7.3.290.0060.00916.42
7.3.280.0090.01116.39
7.3.270.0040.01417.40
7.3.260.0110.01516.47
7.3.250.0170.00316.48
7.3.240.0080.00916.52
7.3.230.0080.00816.46
7.3.210.0090.00916.46
7.3.200.0070.01319.39
7.3.190.0180.00316.49
7.3.180.0120.00316.29
7.3.170.0060.01016.48
7.3.160.0060.01216.69
7.3.120.0070.00714.82
7.3.10.0030.01016.58
7.3.00.0080.00416.27
7.2.330.0150.00616.77
7.2.320.0120.00616.76
7.2.310.0140.00316.71
7.2.300.0120.00416.81
7.2.290.0100.00716.54
7.2.130.0000.01716.97
7.2.120.0070.00716.93
7.2.110.0030.01016.87
7.2.100.0040.00416.75
7.2.90.0070.00717.07
7.2.80.0000.01816.85
7.2.70.0030.00916.96
7.2.60.0000.01416.86
7.2.50.0000.01317.01
7.2.40.0070.00716.86
7.2.30.0040.00716.70
7.2.20.0090.00316.85
7.2.10.0000.00916.92
7.2.00.0030.00818.12
7.1.250.0120.00015.41
7.1.100.0070.00718.39
7.1.70.0040.00417.25
7.1.60.0100.01319.46
7.1.50.0100.01416.86
7.1.00.0100.07022.32
7.0.200.0000.00716.55
7.0.140.0130.06322.18
7.0.60.0070.07019.84
7.0.50.0030.08717.87
7.0.40.0030.04320.25
7.0.30.0570.03720.33
7.0.20.0230.06020.07
7.0.10.0300.05720.08
7.0.00.0070.08720.24
5.6.280.0030.07021.13
5.6.210.0130.04020.73
5.6.200.0170.07018.24
5.6.190.0130.08320.61
5.6.180.0200.05320.41
5.6.170.0200.04320.55
5.6.160.0130.05320.47
5.6.150.0100.08018.13
5.6.140.0130.07718.15
5.6.130.0070.07018.24
5.6.120.0070.08021.04
5.6.110.0100.06021.00
5.6.100.0100.08020.98
5.6.90.0030.08721.04
5.6.80.0070.04720.54
5.6.70.0370.05720.42
5.5.350.0130.02720.48
5.5.340.0000.08318.08
5.5.330.0030.04020.57
5.5.320.0430.07320.24
5.5.310.0230.07320.32
5.5.300.0070.04018.07
5.5.290.0130.06718.04
5.5.280.0070.08020.78
5.5.270.0070.06720.87
5.5.260.0070.07320.77
5.5.250.0100.05720.64
5.5.240.0100.07720.20
5.4.450.0970.07719.55
5.4.440.0830.07719.66
5.4.430.0900.07019.61
5.4.420.0800.05019.54
5.4.410.0700.05719.42
5.4.400.0470.06019.05
5.4.390.0770.06319.14
5.4.380.0330.05018.79
5.4.370.0570.05018.79
5.4.360.0230.05318.57
5.4.350.0230.06318.45
5.4.340.0300.05018.79
5.4.320.0050.04812.50
5.4.310.0060.04112.51
5.4.300.0040.03812.51
5.4.290.0030.04612.48
5.4.280.0090.03412.39
5.4.270.0080.04112.38
5.4.260.0080.05412.39
5.4.250.0100.05612.39
5.4.240.0050.05812.39
5.4.230.0050.05612.38
5.4.220.0070.05312.38
5.4.210.0100.03412.38
5.4.200.0100.03612.38
5.4.190.0080.03912.38
5.4.180.0100.05412.38
5.4.170.0080.04412.39
5.4.160.0090.03612.38
5.4.150.0100.03412.38
5.4.140.0060.03912.06
5.4.130.0050.03912.05
5.4.120.0040.04512.00
5.4.110.0070.04612.01
5.4.100.0060.03812.01
5.4.90.0050.04012.00
5.4.80.0100.04212.00
5.4.70.0060.03812.00
5.4.60.0030.04012.00
5.4.50.0040.03812.00
5.4.40.0090.03311.98
5.4.30.0090.03611.98
5.4.20.0040.03911.98
5.4.10.0080.03311.98
5.4.00.0090.04711.47
5.3.290.0050.05112.80
5.3.280.0150.04312.71
5.3.270.0070.04112.73
5.3.260.0040.04612.72
5.3.250.0070.04312.72
5.3.240.0040.04712.72
5.3.230.0060.03812.71
5.3.220.0060.03712.68
5.3.210.0050.04112.68
5.3.200.0050.04212.68
5.3.190.0100.04112.68
5.3.180.0070.04712.67
5.3.170.0160.05312.67
5.3.160.0120.04912.67
5.3.150.0130.04912.67
5.3.140.0070.03812.66
5.3.130.0040.05512.66
5.3.120.0060.04312.65
5.3.110.0100.04512.65
5.3.100.0060.04712.13
5.3.90.0060.04512.11
5.3.80.0070.04512.10
5.3.70.0100.04312.10
5.3.60.0080.05012.08
5.3.50.0080.04812.03
5.3.40.0080.04712.04
5.3.30.0090.04711.99
5.3.20.0110.04311.77
5.3.10.0110.03211.74
5.3.00.0070.03711.73
5.2.170.0050.0409.23
5.2.160.0100.0389.23
5.2.150.0060.0319.23
5.2.140.0090.0319.23
5.2.130.0050.0309.19
5.2.120.0040.0319.19
5.2.110.0050.0319.19
5.2.100.0020.0339.19
5.2.90.0060.0309.19
5.2.80.0070.0319.18
5.2.70.0060.0359.18
5.2.60.0110.0619.14
5.2.50.0110.0479.11
5.2.40.0070.0439.09
5.2.30.0030.0479.05
5.2.20.0110.0369.04
5.2.10.0080.0378.94
5.2.00.0050.0428.82
5.1.60.0060.0348.10
5.1.50.0060.0348.10
5.1.40.0080.0408.08
5.1.30.0060.0388.43
5.1.20.0070.0288.45
5.1.10.0040.0298.18
5.1.00.0050.0258.17
5.0.50.0020.0236.65
5.0.40.0030.0246.52
5.0.30.0030.0336.32
5.0.20.0060.0266.29
5.0.10.0020.0306.27
5.0.00.0020.0356.27
4.4.90.0020.0204.78
4.4.80.0020.0174.75
4.4.70.0030.0174.76
4.4.60.0040.0154.75
4.4.50.0070.0204.77
4.4.40.0050.0324.71
4.4.30.0040.0174.76
4.4.20.0040.0144.84
4.4.10.0050.0184.85
4.4.00.0020.0264.76
4.3.110.0040.0144.67
4.3.100.0050.0134.66
4.3.90.0040.0144.63
4.3.80.0030.0254.58
4.3.70.0010.0174.63
4.3.60.0050.0134.63
4.3.50.0040.0144.63
4.3.40.0040.0234.54
4.3.30.0030.0153.30
4.3.20.0020.0163.28
4.3.10.0030.0153.24
4.3.00.0000.01310.54

preferences:
46.87 ms | 401 KiB | 5 Q