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]; $test->__set($array[$first_key] , $blah[($blah[$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.63
8.3.50.0220.00921.96
8.3.40.0100.01018.67
8.3.30.0040.01119.30
8.3.20.0070.00720.12
8.3.10.0050.00323.57
8.3.00.0050.00319.25
8.2.180.0090.00918.51
8.2.170.0100.00722.96
8.2.160.0070.01020.47
8.2.150.0030.00524.18
8.2.140.0040.00424.66
8.2.130.0110.00826.16
8.2.120.0070.00022.30
8.2.110.0070.00422.13
8.2.100.0080.00417.83
8.2.90.0030.00619.23
8.2.80.0000.00817.97
8.2.70.0000.00817.75
8.2.60.0000.00817.80
8.2.50.0000.01018.07
8.2.40.0060.00319.75
8.2.30.0000.00718.18
8.2.20.0000.00717.75
8.2.10.0040.00417.98
8.2.00.0070.00417.65
8.1.280.0070.01125.92
8.1.270.0030.00623.92
8.1.260.0030.00526.35
8.1.250.0040.00428.09
8.1.240.0060.00323.86
8.1.230.0040.00719.10
8.1.220.0030.00617.74
8.1.210.0030.00518.77
8.1.200.0060.00317.23
8.1.190.0040.00417.41
8.1.180.0060.00319.00
8.1.170.0000.00818.46
8.1.160.0040.00421.97
8.1.150.0000.01018.55
8.1.140.0040.00417.35
8.1.130.0030.00317.84
8.1.120.0070.00017.44
8.1.110.0040.00717.40
8.1.100.0000.00717.44
8.1.90.0040.00417.41
8.1.80.0000.00717.32
8.1.70.0070.00017.43
8.1.60.0040.00417.67
8.1.50.0000.00817.53
8.1.40.0070.00017.41
8.1.30.0030.00517.64
8.1.20.0000.00817.64
8.1.10.0030.00617.57
8.1.00.0030.00617.43
8.0.300.0030.00618.77
8.0.290.0050.00217.05
8.0.280.0000.00718.32
8.0.270.0050.00317.20
8.0.260.0030.00317.19
8.0.250.0050.00216.85
8.0.240.0040.00416.98
8.0.230.0070.00016.96
8.0.220.0040.00416.97
8.0.210.0060.00316.93
8.0.200.0000.00716.88
8.0.190.0080.00016.88
8.0.180.0070.00316.93
8.0.170.0040.00416.94
8.0.160.0040.00416.97
8.0.150.0030.00416.84
8.0.140.0030.00416.90
8.0.130.0080.00013.41
8.0.120.0030.00516.92
8.0.110.0040.00416.91
8.0.100.0000.00716.95
8.0.90.0040.00416.76
8.0.80.0060.00916.92
8.0.70.0040.00416.75
8.0.60.0060.00316.80
8.0.50.0020.00516.96
8.0.30.0140.00517.09
8.0.20.0100.01317.43
8.0.10.0040.00417.14
8.0.00.0050.01316.77
7.4.330.0000.00615.00
7.4.320.0030.00316.49
7.4.300.0030.00316.42
7.4.290.0070.00016.62
7.4.280.0000.00716.38
7.4.270.0040.00416.55
7.4.260.0030.00316.64
7.4.250.0080.00016.58
7.4.240.0020.00516.58
7.4.230.0030.00316.72
7.4.220.0120.00616.71
7.4.210.0050.01216.54
7.4.200.0040.00416.59
7.4.190.0050.00316.70
7.4.160.0160.00016.68
7.4.150.0150.00417.40
7.4.140.0100.01017.86
7.4.130.0080.01016.56
7.4.120.0120.00816.53
7.4.110.0090.00916.34
7.4.100.0070.01116.68
7.4.90.0100.00716.66
7.4.80.0070.01319.39
7.4.70.0130.00416.69
7.4.60.0130.00916.45
7.4.50.0060.00316.64
7.4.40.0000.01922.77
7.4.30.0070.01016.55
7.4.00.0070.00815.19
7.3.330.0000.00613.45
7.3.320.0000.00513.37
7.3.310.0030.00516.32
7.3.300.0000.00816.35
7.3.290.0030.01016.34
7.3.280.0120.00616.43
7.3.270.0060.01017.40
7.3.260.0150.00916.57
7.3.250.0110.01016.50
7.3.240.0130.00616.71
7.3.230.0060.01216.39
7.3.210.0070.01016.56
7.3.200.0140.00819.39
7.3.190.0130.01016.33
7.3.180.0130.00316.39
7.3.170.0030.01416.62
7.3.160.0040.01316.53
7.3.120.0060.01114.84
7.3.110.0070.01114.90
7.3.100.0070.00714.92
7.3.90.0070.00715.02
7.3.80.0120.00415.04
7.3.70.0070.00714.89
7.3.60.0030.01214.71
7.3.50.0000.01014.84
7.3.40.0060.00614.68
7.3.30.0030.01014.61
7.3.20.0030.00616.73
7.3.10.0090.00616.77
7.3.00.0000.01116.59
7.2.330.0090.01216.67
7.2.320.0110.00716.70
7.2.310.0060.01516.78
7.2.300.0040.01316.53
7.2.290.0100.01316.53
7.2.250.0060.01214.93
7.2.240.0000.01415.18
7.2.230.0110.00715.30
7.2.220.0080.00315.29
7.2.210.0070.00714.92
7.2.200.0080.00615.10
7.2.190.0030.01215.09
7.2.180.0040.01115.16
7.2.170.0060.00915.00
7.2.60.0030.01016.77
7.2.00.0070.00719.49
7.1.330.0090.00615.83
7.1.320.0030.00715.82
7.1.310.0120.00016.00
7.1.300.0030.00815.52
7.1.290.0120.00015.77
7.1.280.0060.00615.88
7.1.270.0000.01515.93
7.1.260.0070.00715.81
7.1.200.0070.00715.81
7.1.100.0040.00818.37
7.1.70.0000.00717.24
7.1.60.0130.00619.46
7.1.50.0070.01517.10
7.1.00.0000.08022.44
7.0.200.0050.00516.56
7.0.140.0000.07721.95
7.0.60.0130.04320.05
7.0.50.0100.07317.98
7.0.40.0200.07020.36
7.0.30.0530.07320.08
7.0.20.0270.03720.30
7.0.10.0130.08020.07
7.0.00.0070.08320.08
5.6.280.0070.07320.92
5.6.210.0070.05020.77
5.6.200.0100.08018.25
5.6.190.0030.09020.63
5.6.180.0270.03020.39
5.6.170.0270.05020.46
5.6.160.0070.04720.56
5.6.150.0000.04318.17
5.6.140.0030.05018.28
5.6.130.0100.07318.18
5.6.120.0130.08021.00
5.6.110.0100.06321.14
5.6.100.0030.04320.99
5.6.90.0130.06321.13
5.6.80.0130.08020.42
5.5.350.0230.07020.40
5.5.340.0030.04018.00
5.5.330.0070.05320.40
5.5.320.0230.05720.27
5.5.310.0270.04320.42
5.5.300.0030.05718.01
5.5.290.0070.03718.08
5.5.280.0030.09320.96
5.5.270.0130.08320.88
5.5.260.0070.08720.68
5.5.250.0130.06320.56
5.5.240.0370.06020.20
5.4.450.0830.05719.29
5.4.440.0700.06319.55
5.4.430.0100.05719.52
5.4.420.0100.05719.18
5.4.410.0570.05719.21
5.4.400.0830.05719.05
5.4.390.0370.06019.24
5.4.380.0270.06018.48
5.4.370.0330.06318.57
5.4.360.0400.05018.80
5.4.350.0300.06718.73
5.4.340.0300.05718.53
5.4.320.0030.04012.51
5.4.310.0060.04612.50
5.4.300.0060.04512.51
5.4.290.0090.03812.48
5.4.280.0050.04012.38
5.4.270.0070.04012.39
5.4.260.0070.04312.39
5.4.250.0080.04212.38
5.4.240.0070.05212.38
5.4.230.0120.04112.38
5.4.220.0070.04512.38
5.4.210.0150.05612.38
5.4.200.0060.04012.38
5.4.190.0050.04012.38
5.4.180.0070.03512.37
5.4.170.0080.03512.39
5.4.160.0090.03612.38
5.4.150.0080.04012.38
5.4.140.0070.04312.05
5.4.130.0090.04612.05
5.4.120.0090.04812.00
5.4.110.0080.05512.00
5.4.100.0090.05012.00
5.4.90.0090.04612.00
5.4.80.0040.04712.00
5.4.70.0090.03611.99
5.4.60.0060.04112.00
5.4.50.0080.03712.00
5.4.40.0090.03611.98
5.4.30.0090.05011.98
5.4.20.0120.06611.98
5.4.10.0130.04311.98
5.4.00.0050.05111.47
5.3.290.0090.04112.80
5.3.280.0060.03912.71
5.3.270.0040.04212.73
5.3.260.0060.04012.72
5.3.250.0060.04012.72
5.3.240.0100.05212.72
5.3.230.0090.05112.71
5.3.220.0060.04112.68
5.3.210.0120.03612.68
5.3.200.0050.04012.68
5.3.190.0090.03912.68
5.3.180.0050.05612.67
5.3.170.0050.04212.67
5.3.160.0100.04812.68
5.3.150.0080.04012.68
5.3.140.0080.03612.66
5.3.130.0060.04512.66
5.3.120.0070.04412.66
5.3.110.0090.03912.66
5.3.100.0060.04012.13
5.3.90.0060.04112.11
5.3.80.0060.03712.10
5.3.70.0060.03712.10
5.3.60.0070.03712.09
5.3.50.0080.03812.04
5.3.40.0110.04112.04
5.3.30.0040.03911.99
5.3.20.0060.04611.77
5.3.10.0110.03311.74
5.3.00.0100.06911.73
5.2.170.0090.0419.23
5.2.160.0070.0429.23
5.2.150.0040.0479.23
5.2.140.0030.0479.23
5.2.130.0060.0439.19
5.2.120.0060.0379.19
5.2.110.0080.0319.19
5.2.100.0050.0309.19
5.2.90.0030.0309.19
5.2.80.0060.0349.19
5.2.70.0070.0309.19
5.2.60.0050.0349.14
5.2.50.0060.0329.11
5.2.40.0050.0399.09
5.2.30.0070.0299.06
5.2.20.0070.0339.05
5.2.10.0040.0338.95
5.2.00.0060.0338.82
5.1.60.0050.0278.10
5.1.50.0040.0288.10
5.1.40.0190.0518.08
5.1.30.0070.0278.43
5.1.20.0070.0308.45
5.1.10.0050.0298.18
5.1.00.0080.0268.18
5.0.50.0060.0216.66
5.0.40.0030.0226.52
5.0.30.0030.0356.33
5.0.20.0030.0216.29
5.0.10.0080.0186.28
5.0.00.0040.0316.27
4.4.90.0040.0154.78
4.4.80.0050.0154.75
4.4.70.0020.0174.75
4.4.60.0020.0194.75
4.4.50.0040.0164.77
4.4.40.0040.0254.71
4.4.30.0010.0184.75
4.4.20.0030.0164.84
4.4.10.0060.0154.85
4.4.00.0030.0284.76
4.3.110.0030.0174.67
4.3.100.0020.0184.67
4.3.90.0020.0164.63
4.3.80.0030.0254.58
4.3.70.0030.0174.63
4.3.60.0020.0174.63
4.3.50.0030.0184.63
4.3.40.0050.0324.54
4.3.30.0030.0223.30
4.3.20.0030.0223.28
4.3.10.0020.0223.24
4.3.00.0070.03310.54

preferences:
45.94 ms | 401 KiB | 5 Q