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.0040.01118.54
8.3.50.0120.00721.98
8.3.40.0070.01018.93
8.3.30.0150.00019.14
8.3.20.0000.00720.34
8.3.10.0080.00023.72
8.3.00.0080.00019.50
8.2.180.0030.01516.88
8.2.170.0070.01122.96
8.2.160.0100.00320.46
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0150.00326.16
8.2.120.0080.00022.13
8.2.110.0080.00022.09
8.2.100.0110.00017.91
8.2.90.0080.00019.17
8.2.80.0040.00417.97
8.2.70.0060.00317.63
8.2.60.0000.00818.04
8.2.50.0070.00318.07
8.2.40.0060.00320.07
8.2.30.0050.00218.09
8.2.20.0040.00417.86
8.2.10.0030.00518.15
8.2.00.0000.01117.71
8.1.280.0100.00325.92
8.1.270.0030.00523.96
8.1.260.0030.00626.35
8.1.250.0050.00228.09
8.1.240.0090.00023.93
8.1.230.0040.00719.00
8.1.220.0030.00517.74
8.1.210.0080.00018.77
8.1.200.0060.00317.47
8.1.190.0080.00017.41
8.1.180.0050.00418.96
8.1.170.0040.00418.61
8.1.160.0070.00022.05
8.1.150.0070.00318.58
8.1.140.0000.00717.52
8.1.130.0030.00317.90
8.1.120.0070.00017.50
8.1.110.0000.01017.48
8.1.100.0040.00417.46
8.1.90.0070.00017.47
8.1.80.0040.00417.50
8.1.70.0030.00517.41
8.1.60.0040.00417.55
8.1.50.0040.00417.50
8.1.40.0000.00817.40
8.1.30.0040.00417.58
8.1.20.0050.00317.63
8.1.10.0040.00417.49
8.1.00.0040.00417.57
8.0.300.0000.00718.77
8.0.290.0060.00317.18
8.0.280.0070.00018.36
8.0.270.0030.00317.24
8.0.260.0000.00617.27
8.0.250.0030.00317.09
8.0.240.0040.00417.12
8.0.230.0000.00717.04
8.0.220.0020.00416.97
8.0.210.0070.00016.86
8.0.200.0050.00216.96
8.0.190.0040.00417.04
8.0.180.0000.00717.00
8.0.170.0040.00416.88
8.0.160.0000.00716.95
8.0.150.0030.00517.03
8.0.140.0000.00716.93
8.0.130.0060.00013.45
8.0.120.0030.00616.91
8.0.110.0050.00316.88
8.0.100.0000.00716.88
8.0.90.0030.00316.88
8.0.80.0070.01016.95
8.0.70.0050.00216.89
8.0.60.0030.00516.97
8.0.50.0040.00416.93
8.0.30.0110.00817.13
8.0.20.0140.00617.40
8.0.10.0000.00717.09
8.0.00.0050.01416.96
7.4.330.0050.00015.00
7.4.320.0060.00016.63
7.4.300.0030.00316.68
7.4.290.0000.00716.52
7.4.280.0040.00416.64
7.4.270.0000.00716.52
7.4.260.0070.00016.52
7.4.250.0030.00616.45
7.4.240.0030.00516.60
7.4.230.0070.00016.35
7.4.220.0100.00716.66
7.4.210.0070.00816.63
7.4.200.0040.00416.43
7.4.190.0080.00016.67
7.4.160.0080.00816.61
7.4.150.0100.00717.40
7.4.140.0090.01117.86
7.4.130.0090.00916.69
7.4.120.0110.00916.65
7.4.110.0100.00716.61
7.4.100.0160.00616.70
7.4.90.0030.01416.59
7.4.80.0150.00419.39
7.4.70.0120.01016.74
7.4.60.0060.01016.41
7.4.50.0030.00316.64
7.4.40.0030.01022.77
7.4.30.0130.00616.40
7.4.00.0130.00714.79
7.3.330.0030.00313.39
7.3.320.0030.00313.41
7.3.310.0070.00016.41
7.3.300.0040.00416.30
7.3.290.0030.01016.42
7.3.280.0080.00916.42
7.3.270.0070.01017.40
7.3.260.0080.00816.78
7.3.250.0150.00516.44
7.3.240.0120.00916.36
7.3.230.0100.01316.45
7.3.210.0100.01016.48
7.3.200.0100.00719.39
7.3.190.0070.01016.44
7.3.180.0160.00716.38
7.3.170.0060.01116.47
7.3.160.0030.01216.55
7.3.120.0030.01015.02
7.3.110.0070.01014.72
7.3.100.0070.00414.78
7.3.90.0110.00415.02
7.3.80.0060.00914.70
7.3.70.0050.00515.04
7.3.60.0070.01014.90
7.3.50.0060.00314.96
7.3.40.0070.01014.63
7.3.30.0100.00614.95
7.3.20.0060.00616.71
7.3.10.0070.00716.66
7.3.00.0070.01016.67
7.2.330.0070.01816.41
7.2.320.0030.01316.41
7.2.310.0110.00516.41
7.2.300.0000.01616.59
7.2.290.0110.00516.82
7.2.250.0030.01715.27
7.2.240.0030.01615.26
7.2.230.0060.00915.07
7.2.220.0060.01215.16
7.2.210.0170.00015.03
7.2.200.0030.01215.07
7.2.190.0140.00314.85
7.2.180.0030.00615.22
7.2.170.0080.00415.11
7.2.160.0070.00714.86
7.2.150.0040.01117.11
7.2.140.0060.01017.05
7.2.130.0070.01017.16
7.2.120.0100.00716.72
7.2.110.0110.00016.88
7.2.100.0000.01017.12
7.2.90.0030.01317.08
7.2.80.0100.00716.98
7.2.70.0000.01417.08
7.2.60.0070.00716.97
7.2.50.0030.01016.98
7.2.40.0040.00716.69
7.2.30.0130.00016.99
7.2.20.0090.00417.14
7.2.10.0070.00716.75
7.2.00.0080.00416.77
7.1.330.0040.01116.02
7.1.320.0030.00615.45
7.1.310.0030.01015.92
7.1.300.0060.00615.82
7.1.290.0000.01115.54
7.1.280.0070.01015.55
7.1.270.0040.01115.84
7.1.260.0000.01615.91
7.1.250.0030.00615.51
7.1.200.0040.00815.69
7.1.70.0060.00317.29
7.1.60.0060.01219.46
7.1.50.0030.01317.06
7.1.00.0070.07322.45
7.0.200.0050.00216.80
7.0.140.0070.07021.99
7.0.60.0130.07019.96
7.0.50.0130.07717.88
7.0.40.0030.05320.35
7.0.30.0530.05720.23
7.0.20.0300.08320.19
7.0.10.0000.09020.23
7.0.00.0170.07020.12
5.6.280.0070.07021.07
5.6.210.0030.06020.48
5.6.200.0000.04718.19
5.6.190.0100.03720.63
5.6.180.0230.07720.61
5.6.170.0270.08320.61
5.6.160.0100.06020.44
5.6.150.0100.06718.21
5.6.140.0070.07018.20
5.6.130.0030.04718.13
5.6.120.0100.08721.01
5.6.110.0030.05321.10
5.6.100.0030.04321.11
5.6.90.0000.04720.98
5.6.80.0000.06720.44
5.5.350.0000.09020.37
5.5.340.0100.07717.95
5.5.330.0100.06320.43
5.5.320.0170.08020.20
5.5.310.0330.06720.19
5.5.300.0070.06318.03
5.5.290.0070.04317.97
5.5.280.0170.07720.74
5.5.270.0070.06020.73
5.5.260.0070.08720.79
5.5.250.0000.06020.67
5.5.240.3600.03020.36
5.4.450.0630.06319.57
5.4.440.0670.06019.37
5.4.430.0100.05319.56
5.4.420.0730.06719.15
5.4.410.0630.05319.24
5.4.400.0870.05319.14
5.4.390.0830.05719.13
5.4.380.0370.05018.80
5.4.370.0370.06318.57
5.4.360.0200.06018.54
5.4.350.0330.05018.57
5.4.340.0300.05718.69
5.4.320.0070.03712.50
5.4.310.0060.04012.51
5.4.300.0050.04012.51
5.4.290.0080.04112.49
5.4.280.0060.04212.39
5.4.270.0060.05012.38
5.4.260.0100.06112.39
5.4.250.0080.05012.39
5.4.240.0080.04712.39
5.4.230.0100.05112.38
5.4.220.0110.04812.38
5.4.210.0090.04412.38
5.4.200.0130.04512.38
5.4.190.0070.04412.38
5.4.180.0110.03612.38
5.4.170.0070.03812.39
5.4.160.0070.03912.38
5.4.150.0060.03812.38
5.4.140.0070.03912.06
5.4.130.0150.02912.05
5.4.120.0060.03712.00
5.4.110.0090.03512.01
5.4.100.0050.04012.00
5.4.90.0070.03812.01
5.4.80.0120.03312.00
5.4.70.0100.03312.00
5.4.60.0080.03512.00
5.4.50.0100.03412.00
5.4.40.0040.04011.98
5.4.30.0120.03211.98
5.4.20.0060.04011.98
5.4.10.0070.04011.98
5.4.00.0050.04011.47
5.3.290.0080.04112.80
5.3.280.0070.04912.71
5.3.270.0090.05712.72
5.3.260.0180.07612.72
5.3.250.0090.05712.72
5.3.240.0140.05212.72
5.3.230.0080.04312.71
5.3.220.0080.04712.68
5.3.210.0080.04312.68
5.3.200.0080.04612.68
5.3.190.0070.04212.68
5.3.180.0070.04512.67
5.3.170.0080.03912.67
5.3.160.0070.04212.68
5.3.150.0150.04712.68
5.3.140.0110.04612.66
5.3.130.0090.05712.66
5.3.120.0090.05512.66
5.3.110.0130.05012.66
5.3.100.0130.04512.13
5.3.90.0110.04812.11
5.3.80.0070.04412.10
5.3.70.0110.04712.10
5.3.60.0110.09412.09
5.3.50.0100.06912.03
5.3.40.0170.07312.03
5.3.30.0110.05211.99
5.3.20.0100.04811.77
5.3.10.0100.04811.74
5.3.00.0080.05111.72
5.2.170.0050.0459.23
5.2.160.0080.0419.23
5.2.150.0080.0429.23
5.2.140.0060.0439.23
5.2.130.0040.0449.19
5.2.120.0060.0419.18
5.2.110.0070.0339.20
5.2.100.0050.0479.19
5.2.90.0100.0399.19
5.2.80.0030.0469.18
5.2.70.0140.0359.18
5.2.60.0160.0339.14
5.2.50.0080.0419.11
5.2.40.0060.0309.09
5.2.30.0050.0409.06
5.2.20.0110.0379.04
5.2.10.0070.0428.95
5.2.00.0080.0328.82
5.1.60.0070.0288.10
5.1.50.0080.0268.10
5.1.40.0060.0348.07
5.1.30.0040.0378.43
5.1.20.0110.0388.45
5.1.10.0080.0338.18
5.1.00.0040.0328.17
5.0.50.0040.0266.65
5.0.40.0070.0226.51
5.0.30.0030.0436.32
5.0.20.0080.0306.29
5.0.10.0130.0266.27
5.0.00.0060.0396.27
4.4.90.0050.0224.78
4.4.80.0080.0194.75
4.4.70.0020.0254.76
4.4.60.0050.0204.75
4.4.50.0050.0214.77
4.4.40.0050.0334.70
4.4.30.0050.0214.76
4.4.20.0040.0224.84
4.4.10.0040.0214.85
4.4.00.0030.0344.76
4.3.110.0030.0344.67
4.3.100.0030.0304.67
4.3.90.0080.0244.64
4.3.80.0040.0354.58
4.3.70.0020.0204.63
4.3.60.0070.0184.63
4.3.50.0060.0224.63
4.3.40.0050.0334.54
4.3.30.0020.0233.30
4.3.20.0050.0203.28
4.3.10.0040.0213.23
4.3.00.0030.01313.17

preferences:
38.52 ms | 401 KiB | 5 Q