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 die($key ); $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); 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.0120.00316.63
8.3.50.0260.00721.95
8.3.40.0180.00018.67
8.3.30.0040.01119.15
8.3.20.0090.00020.33
8.3.10.0080.00023.65
8.3.00.0080.00019.38
8.2.180.0120.00618.54
8.2.170.0120.00322.96
8.2.160.0100.00320.53
8.2.150.0050.00324.18
8.2.140.0050.00324.66
8.2.130.0090.00926.16
8.2.120.0070.00022.11
8.2.110.0040.00422.30
8.2.100.0060.00617.78
8.2.90.0000.00819.02
8.2.80.0040.00418.04
8.2.70.0000.00917.63
8.2.60.0030.00617.88
8.2.50.0030.00618.07
8.2.40.0040.00420.07
8.2.30.0060.00318.08
8.2.20.0040.00417.87
8.2.10.0040.00417.95
8.2.00.0000.01017.71
8.1.280.0070.01125.92
8.1.270.0040.00423.97
8.1.260.0060.00326.35
8.1.250.0050.00228.09
8.1.240.0030.00623.66
8.1.230.0080.00319.10
8.1.220.0040.00417.74
8.1.210.0040.00818.77
8.1.200.0090.00017.38
8.1.190.0000.00817.53
8.1.180.0000.00818.10
8.1.170.0060.00318.64
8.1.160.0040.00421.96
8.1.150.0090.00018.59
8.1.140.0070.00017.40
8.1.130.0000.00717.89
8.1.120.0000.00717.38
8.1.110.0080.00317.40
8.1.100.0040.00417.31
8.1.90.0040.00417.45
8.1.80.0070.00017.35
8.1.70.0040.00417.41
8.1.60.0000.00817.55
8.1.50.0050.00317.60
8.1.40.0000.00817.59
8.1.30.0040.00417.63
8.1.20.0040.00417.71
8.1.10.0000.00817.50
8.1.00.0060.00317.49
8.0.300.0000.00819.28
8.0.290.0070.00017.05
8.0.280.0030.00518.35
8.0.270.0030.00317.18
8.0.260.0070.00017.18
8.0.250.0070.00016.95
8.0.240.0050.00316.88
8.0.230.0000.00717.00
8.0.220.0030.00316.90
8.0.210.0090.00016.78
8.0.200.0030.00316.88
8.0.190.0040.00416.87
8.0.180.0090.00316.96
8.0.170.0080.00016.90
8.0.160.0070.00016.96
8.0.150.0080.00016.97
8.0.140.0040.00416.88
8.0.130.0000.00713.30
8.0.120.0050.00316.79
8.0.110.0000.00816.84
8.0.100.0000.00716.91
8.0.90.0040.00416.80
8.0.80.0060.01016.89
8.0.70.0070.00016.97
8.0.60.0050.00316.89
8.0.50.0000.00716.71
8.0.30.0130.00617.13
8.0.20.0090.01117.40
8.0.10.0000.00817.05
8.0.00.0090.01016.89
7.4.330.0020.00215.00
7.4.320.0030.00316.64
7.4.300.0060.00016.54
7.4.290.0040.00416.53
7.4.280.0030.00316.58
7.4.270.0000.00716.47
7.4.260.0050.00216.41
7.4.250.0080.00016.51
7.4.240.0000.00716.63
7.4.230.0030.00316.50
7.4.220.0090.00916.62
7.4.210.0070.01016.64
7.4.200.0030.00316.41
7.4.190.0000.00716.47
7.4.160.0060.00916.63
7.4.150.0140.01117.40
7.4.140.0080.00917.86
7.4.130.0080.00916.53
7.4.120.0110.01116.59
7.4.110.0100.01016.59
7.4.100.0090.00916.52
7.4.90.0100.01016.48
7.4.80.0110.01119.39
7.4.70.0070.01016.70
7.4.60.0110.00616.43
7.4.50.0000.00816.33
7.4.40.0060.00622.77
7.4.30.0130.00616.34
7.4.00.0000.01815.07
7.3.330.0000.00613.29
7.3.320.0000.00513.27
7.3.310.0000.00716.48
7.3.300.0030.00616.37
7.3.290.0130.00016.49
7.3.280.0070.00716.40
7.3.270.0090.00917.40
7.3.260.0070.01716.41
7.3.250.0090.00816.47
7.3.240.0100.01316.47
7.3.230.0190.00616.39
7.3.210.0090.00916.43
7.3.200.0070.01019.39
7.3.190.0080.01116.52
7.3.180.0060.01016.32
7.3.170.0040.01216.55
7.3.160.0060.01616.46
7.3.120.0000.01314.87
7.2.330.0190.00016.55
7.2.320.0090.01116.64
7.2.310.0130.00316.71
7.2.300.0060.01116.76
7.2.290.0090.00916.82
7.2.00.0030.01319.43
7.1.200.0060.00615.76
7.1.100.0150.00818.22
7.1.70.0050.00517.22
7.1.60.0070.00316.95
7.1.50.0030.01716.62
7.1.00.0070.07322.40
7.0.200.0060.00916.53
7.0.140.0030.07321.96
7.0.60.0130.07319.93
7.0.50.0000.07317.88
7.0.40.0000.09320.23
7.0.30.0330.06720.17
7.0.20.0300.05020.23
7.0.10.0070.07720.24
7.0.00.0030.08720.07
5.6.280.0070.07020.79
5.6.210.0070.08020.77
5.6.200.0100.07318.18
5.6.190.0030.04320.61
5.6.180.0230.08020.61
5.6.170.0200.04320.54
5.6.160.0030.05020.44
5.6.150.0070.08018.16
5.6.140.0030.08718.18
5.6.130.0100.07318.27
5.6.120.0100.08021.02
5.6.110.0030.09020.99
5.6.100.0130.07721.01
5.6.90.0030.08320.98
5.6.80.0070.06320.52
5.6.70.4230.04720.37
5.5.350.0230.07320.50
5.5.340.0030.04318.08
5.5.330.0030.08320.25
5.5.320.0400.07020.20
5.5.310.0270.07720.31
5.5.300.0030.05018.02
5.5.290.0070.07317.95
5.5.280.0100.04720.81
5.5.270.0100.04720.69
5.5.260.0130.08020.80
5.5.250.0000.04720.47
5.5.240.0270.07020.24
5.4.450.0570.05719.39
5.4.440.0700.06319.44
5.4.430.0630.06019.36
5.4.420.0730.05319.52
5.4.410.0130.05319.26
5.4.400.0930.05319.12
5.4.390.0630.05719.24
5.4.380.0370.04718.75
5.4.370.0330.06318.59
5.4.360.0470.04318.75
5.4.350.0330.05318.53
5.4.340.0370.04718.54
5.4.320.0040.04212.51
5.4.310.0060.04212.50
5.4.300.0090.03312.51
5.4.290.0100.04112.49
5.4.280.0070.04712.38
5.4.270.0090.04812.39
5.4.260.0040.05412.39
5.4.250.0120.04712.38
5.4.240.0110.03812.39
5.4.230.0090.03912.38
5.4.220.0090.03712.38
5.4.210.0070.03812.38
5.4.200.0040.04812.38
5.4.190.0110.03812.37
5.4.180.0070.03712.38
5.4.170.0030.04112.38
5.4.160.0050.04212.38
5.4.150.0070.04112.38
5.4.140.0120.03312.06
5.4.130.0070.03512.05
5.4.120.0070.03612.00
5.4.110.0070.03712.00
5.4.100.0130.05012.00
5.4.90.0080.03912.00
5.4.80.0090.05212.00
5.4.70.0060.03912.00
5.4.60.0080.04512.00
5.4.50.0100.04211.99
5.4.40.0070.05211.98
5.4.30.0100.05211.98
5.4.20.0070.05311.98
5.4.10.0060.06411.98
5.4.00.0080.07211.47
5.3.290.0080.04012.80
5.3.280.0150.06612.71
5.3.270.0070.06312.72
5.3.260.0130.06512.72
5.3.250.0090.05712.72
5.3.240.0090.05712.71
5.3.230.0060.04912.71
5.3.220.0100.04812.68
5.3.210.0070.06512.68
5.3.200.0120.05612.68
5.3.190.0060.05912.67
5.3.180.0080.04012.67
5.3.170.0090.05312.67
5.3.160.0090.04012.67
5.3.150.0050.04412.67
5.3.140.0070.04012.66
5.3.130.0100.04712.66
5.3.120.0060.05012.66
5.3.110.0110.04712.66
5.3.100.0070.03812.12
5.3.90.0070.04812.11
5.3.80.0100.04112.10
5.3.70.0040.04212.10
5.3.60.0040.04312.08
5.3.50.0100.03612.04
5.3.40.0110.03812.04
5.3.30.0100.04811.99
5.3.20.0070.03911.77
5.3.10.0120.04011.74
5.3.00.0080.04111.72
5.2.170.0040.0369.23
5.2.160.0070.0359.23
5.2.150.0070.0349.23
5.2.140.0080.0319.23
5.2.130.0070.0319.19
5.2.120.0070.0319.19
5.2.110.0080.0419.20
5.2.100.0090.0419.19
5.2.90.0080.0419.20
5.2.80.0060.0359.18
5.2.70.0050.0359.18
5.2.60.0080.0329.13
5.2.50.0050.0349.11
5.2.40.0030.0339.08
5.2.30.0050.0369.05
5.2.20.0060.0399.04
5.2.10.0050.0318.94
5.2.00.0040.0428.82
5.1.60.0080.0318.10
5.1.50.0060.0258.10
5.1.40.0040.0278.07
5.1.30.0070.0338.43
5.1.20.0100.0258.45
5.1.10.0060.0288.18
5.1.00.0050.0298.18
5.0.50.0040.0206.65
5.0.40.0040.0216.52
5.0.30.0030.0346.32
5.0.20.0040.0206.29
5.0.10.0020.0246.27
5.0.00.0050.0306.27
4.4.90.0040.0154.78
4.4.80.0040.0174.76
4.4.70.0010.0194.75
4.4.60.0020.0174.75
4.4.50.0040.0154.77
4.4.40.0030.0274.71
4.4.30.0010.0184.75
4.4.20.0030.0184.84
4.4.10.0050.0194.85
4.4.00.0040.0314.76
4.3.110.0080.0174.67
4.3.100.0060.0194.67
4.3.90.0050.0214.63
4.3.80.0020.0274.58
4.3.70.0030.0174.63
4.3.60.0030.0214.63
4.3.50.0050.0154.63
4.3.40.0050.0294.54
4.3.30.0050.0183.30
4.3.20.0020.0223.28
4.3.10.0020.0213.24
4.3.00.0300.01710.54

preferences:
45.51 ms | 401 KiB | 5 Q