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[($first_key[$first_key])] = '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();

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.0070.01016.75
8.3.50.0140.00321.97
8.3.40.0090.00918.73
8.3.30.0140.00419.08
8.3.20.0040.00420.35
8.3.10.0050.00323.53
8.3.00.0000.00819.38
8.2.180.0100.01018.29
8.2.170.0090.00622.96
8.2.160.0060.01320.39
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0080.00026.16
8.2.120.0040.00420.96
8.2.110.0080.00022.16
8.2.100.0040.00717.84
8.2.90.0050.00319.08
8.2.80.0040.00417.97
8.2.70.0050.00317.75
8.2.60.0000.01017.79
8.2.50.0030.00618.07
8.2.40.0040.00419.95
8.2.30.0000.00818.04
8.2.20.0000.00717.82
8.2.10.0040.00418.07
8.2.00.0050.00317.84
8.1.280.0140.01025.92
8.1.270.0160.00322.06
8.1.260.0110.00826.35
8.1.250.0040.00428.09
8.1.240.0040.00423.87
8.1.230.0040.00819.04
8.1.220.0040.00417.74
8.1.210.0000.00818.77
8.1.200.0030.00617.23
8.1.190.0000.00717.40
8.1.180.0090.00418.10
8.1.170.0030.00918.21
8.1.160.0000.00721.92
8.1.150.0050.00318.61
8.1.140.0070.00017.41
8.1.130.0000.00717.72
8.1.120.0000.00717.32
8.1.110.0000.01017.31
8.1.100.0030.00517.45
8.1.90.0030.00517.32
8.1.80.0000.00717.37
8.1.70.0000.00717.36
8.1.60.0050.00317.43
8.1.50.0040.00417.55
8.1.40.0050.00317.58
8.1.30.0040.00417.53
8.1.20.0040.00417.58
8.1.10.0000.00717.58
8.1.00.0000.00817.38
8.0.300.0000.00819.07
8.0.290.0000.00817.05
8.0.280.0030.00318.41
8.0.270.0030.00317.12
8.0.260.0030.00317.13
8.0.250.0030.00316.91
8.0.240.0030.00316.85
8.0.230.0000.00716.99
8.0.220.0070.00016.90
8.0.210.0100.00016.96
8.0.200.0040.00417.02
8.0.190.0000.00817.02
8.0.180.0000.00816.97
8.0.170.0060.00316.93
8.0.160.0000.00716.88
8.0.150.0030.00316.77
8.0.140.0000.00716.84
8.0.130.0030.00613.34
8.0.120.0040.00416.77
8.0.110.0040.00416.81
8.0.100.0000.00716.79
8.0.90.0040.00416.91
8.0.80.0090.00616.90
8.0.70.0030.00516.86
8.0.60.0040.00416.89
8.0.50.0000.00716.86
8.0.30.0130.00716.94
8.0.20.0040.01517.40
8.0.10.0050.00217.02
8.0.00.0090.00916.78
7.4.330.0000.00515.00
7.4.320.0000.00616.52
7.4.300.0000.00716.52
7.4.290.0000.00716.53
7.4.280.0030.00316.42
7.4.270.0000.00816.61
7.4.260.0000.00716.63
7.4.250.0050.00216.59
7.4.240.0020.00516.49
7.4.230.0030.00316.37
7.4.220.0120.01216.68
7.4.210.0080.01116.57
7.4.200.0000.00716.63
7.4.190.0070.00016.60
7.4.160.0080.00816.49
7.4.150.0030.01417.40
7.4.140.0090.00917.86
7.4.130.0130.00416.54
7.4.120.0060.01116.64
7.4.110.0150.00316.51
7.4.100.0070.01116.54
7.4.90.0090.01016.46
7.4.80.0100.01019.39
7.4.70.0060.01216.53
7.4.60.0070.01116.71
7.4.50.0030.00616.36
7.4.40.0070.00522.77
7.4.30.0130.01016.51
7.4.00.0030.01215.05
7.3.330.0060.00013.29
7.3.320.0030.00313.34
7.3.310.0000.00716.30
7.3.300.0050.00316.40
7.3.290.0130.00616.43
7.3.280.0080.01116.39
7.3.270.0090.00917.40
7.3.260.0030.01416.32
7.3.250.0110.01316.55
7.3.240.0030.01316.52
7.3.230.0100.00716.39
7.3.210.0130.00316.36
7.3.200.0120.01219.39
7.3.190.0080.00816.52
7.3.180.0070.01016.32
7.3.170.0070.01016.36
7.3.160.0130.00316.65
7.3.120.0030.01014.81
7.3.10.0000.01516.62
7.3.00.0040.00716.45
7.2.330.0090.00916.81
7.2.320.0090.00916.84
7.2.310.0050.01316.67
7.2.300.0000.02116.48
7.2.290.0070.01016.87
7.2.130.0030.01417.00
7.2.120.0000.01316.81
7.2.110.0030.01517.01
7.2.100.0090.00617.14
7.2.90.0080.00416.73
7.2.80.0100.00316.77
7.2.70.0030.01316.99
7.2.60.0030.01216.96
7.2.50.0060.00617.12
7.2.40.0030.00617.10
7.2.30.0090.00316.93
7.2.20.0000.01416.78
7.2.10.0080.00416.95
7.2.00.0070.00518.27
7.1.250.0100.00315.80
7.1.200.0000.01015.88
7.1.100.0000.00818.08
7.1.70.0000.00817.13
7.1.60.0030.01719.46
7.1.50.0110.01117.05
7.1.00.0030.07722.35
7.0.200.0040.00416.71
7.0.140.0030.07322.09
7.0.60.0030.07719.88
7.0.50.0030.05018.00
7.0.40.0100.08320.13
7.0.30.0200.07320.17
7.0.20.0770.04320.06
7.0.10.0030.05020.24
7.0.00.0200.06720.16
5.6.280.0000.07720.83
5.6.210.0070.08020.68
5.6.200.0070.08718.14
5.6.190.0100.04020.77
5.6.180.0270.04320.48
5.6.170.0200.08720.45
5.6.160.0070.04720.55
5.6.150.0030.04018.28
5.6.140.0130.07018.27
5.6.130.0070.06718.16
5.6.120.0000.05021.02
5.6.110.0070.07021.02
5.6.100.0130.04020.99
5.6.90.0100.08021.00
5.6.80.0070.03320.39
5.5.350.0370.04020.44
5.5.340.0130.05018.05
5.5.330.0100.08020.29
5.5.320.0070.08020.25
5.5.310.0400.06720.36
5.5.300.0000.04318.02
5.5.290.0000.06717.97
5.5.280.0030.07720.89
5.5.270.0170.07720.75
5.5.260.0130.06320.80
5.5.250.0230.03720.64
5.5.240.0070.06720.13
5.4.450.0400.04319.45
5.4.440.0100.05319.47
5.4.430.0130.05019.63
5.4.420.0070.06019.43
5.4.410.0030.05719.25
5.4.400.0130.06719.08
5.4.390.0130.06319.18
5.4.380.0270.06018.73
5.4.370.0230.06318.84
5.4.360.0370.08018.84
5.4.350.0400.05018.59
5.4.340.0430.06718.72
5.4.320.0090.03412.51
5.4.310.0090.03712.50
5.4.300.0050.04112.51
5.4.290.0050.04212.49
5.4.280.0100.03712.39
5.4.270.0120.06712.39
5.4.260.0090.04412.38
5.4.250.0090.03912.39
5.4.240.0030.04012.39
5.4.230.0040.04012.38
5.4.220.0080.05112.38
5.4.210.0060.04212.38
5.4.200.0080.05512.38
5.4.190.0080.05312.38
5.4.180.0060.05412.38
5.4.170.0080.05212.39
5.4.160.0040.04912.38
5.4.150.0090.03212.37
5.4.140.0040.03812.06
5.4.130.0040.03712.05
5.4.120.0060.03512.01
5.4.110.0030.04012.00
5.4.100.0060.03712.00
5.4.90.0080.03812.00
5.4.80.0060.04212.00
5.4.70.0110.03512.00
5.4.60.0050.03912.00
5.4.50.0110.03512.00
5.4.40.0070.03711.98
5.4.30.0100.03311.98
5.4.20.0040.04211.98
5.4.10.0070.03811.98
5.4.00.0080.03911.47
5.3.290.0060.04412.80
5.3.280.0080.04212.71
5.3.270.0090.03812.72
5.3.260.0100.03612.72
5.3.250.0060.03812.71
5.3.240.0080.03512.72
5.3.230.0060.04012.71
5.3.220.0120.04712.68
5.3.210.0080.04012.68
5.3.200.0080.03912.68
5.3.190.0060.04912.68
5.3.180.0070.03612.68
5.3.170.0110.04612.67
5.3.160.0090.05612.67
5.3.150.0060.04412.67
5.3.140.0040.04212.66
5.3.130.0060.04112.66
5.3.120.0060.04012.66
5.3.110.0070.05612.66
5.3.100.0070.05112.13
5.3.90.0050.05712.11
5.3.80.0070.04412.11
5.3.70.0040.04012.11
5.3.60.0060.04712.09
5.3.50.0070.03512.04
5.3.40.0040.03812.04
5.3.30.0040.03612.00
5.3.20.0060.03611.78
5.3.10.0110.04411.74
5.3.00.0060.04211.73
5.2.170.0040.0329.23
5.2.160.0050.0299.23
5.2.150.0040.0319.24
5.2.140.0080.0289.23
5.2.130.0050.0309.19
5.2.120.0020.0329.20
5.2.110.0070.0409.20
5.2.100.0040.0449.19
5.2.90.0060.0549.20
5.2.80.0050.0449.19
5.2.70.0030.0489.19
5.2.60.0090.0529.14
5.2.50.0070.0519.11
5.2.40.0090.0399.09
5.2.30.0070.0439.07
5.2.20.0060.0319.05
5.2.10.0070.0298.95
5.2.00.0060.0318.82
5.1.60.0080.0238.10
5.1.50.0060.0488.10
5.1.40.0030.0318.08
5.1.30.0030.0318.43
5.1.20.0040.0348.45
5.1.10.0090.0338.18
5.1.00.0120.0488.18
5.0.50.0060.0496.65
5.0.40.0060.0396.52
5.0.30.0060.0336.32
5.0.20.0030.0216.29
5.0.10.0020.0286.27
5.0.00.0060.0376.27
4.4.90.0020.0234.78
4.4.80.0070.0254.75
4.4.70.0020.0204.75
4.4.60.0060.0174.76
4.4.50.0020.0174.77
4.4.40.0050.0314.71
4.4.30.0030.0174.76
4.4.20.0100.0124.84
4.4.10.0050.0184.85
4.4.00.0020.0294.76
4.3.110.0040.0184.67
4.3.100.0030.0154.66
4.3.90.0040.0144.64
4.3.80.0040.0254.58
4.3.70.0030.0204.63
4.3.60.0040.0194.63
4.3.50.0040.0324.63
4.3.40.0050.0504.54
4.3.30.0020.0203.30
4.3.20.0040.0223.28
4.3.10.0050.0163.23
4.3.00.0030.0206.92

preferences:
49.44 ms | 400 KiB | 5 Q