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 $value = $v(); // and a callback! $this->{$key} = $value; } } $test = new Test; // start editing here class Intercept { public function getKey($test) { $array = (array) $test; 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.70.0110.00718.43
8.3.60.0090.01218.68
8.3.50.0150.00721.97
8.3.40.0070.01118.82
8.3.30.0060.00819.15
8.3.20.0090.00620.07
8.3.10.0040.00423.51
8.3.00.0030.00619.26
8.2.180.0090.00618.43
8.2.170.0120.00322.96
8.2.160.0110.00920.18
8.2.150.0030.00624.18
8.2.140.0070.00024.66
8.2.130.0110.00426.16
8.2.120.0070.00722.11
8.2.110.0000.00922.27
8.2.100.0040.00818.03
8.2.90.0040.00419.22
8.2.80.0080.00017.97
8.2.70.0040.00417.63
8.2.60.0050.00318.03
8.2.50.0000.00818.07
8.2.40.0090.00020.07
8.2.30.0040.00418.11
8.2.20.0040.00417.75
8.2.10.0040.00418.09
8.2.00.0030.00717.80
8.1.280.0100.01025.92
8.1.270.0040.00422.01
8.1.260.0040.00426.35
8.1.250.0050.00328.09
8.1.240.0030.00623.91
8.1.230.0040.00719.16
8.1.220.0060.00317.74
8.1.210.0030.00518.77
8.1.200.0000.00917.35
8.1.190.0040.00417.55
8.1.180.0100.00019.01
8.1.170.0100.00018.36
8.1.160.0000.00722.01
8.1.150.0070.00418.64
8.1.140.0040.00417.38
8.1.130.0000.00717.74
8.1.120.0030.00517.36
8.1.110.0030.00617.42
8.1.100.0000.00717.46
8.1.90.0050.00317.48
8.1.80.0040.00417.50
8.1.70.0040.00417.32
8.1.60.0000.00817.56
8.1.50.0040.00417.58
8.1.40.0040.00417.41
8.1.30.0040.00417.60
8.1.20.0040.00417.55
8.1.10.0050.00317.55
8.1.00.0040.00417.48
8.0.300.0000.00718.77
8.0.290.0040.00417.17
8.0.280.0030.00318.32
8.0.270.0000.00717.26
8.0.260.0000.00617.17
8.0.250.0050.00216.92
8.0.240.0000.00817.07
8.0.230.0000.00716.95
8.0.220.0070.00016.97
8.0.210.0030.00616.86
8.0.200.0000.00716.91
8.0.190.0000.00716.90
8.0.180.0040.00416.98
8.0.170.0060.00316.94
8.0.160.0030.00416.95
8.0.150.0040.00416.88
8.0.140.0000.00716.79
8.0.130.0000.00513.35
8.0.120.0040.00416.94
8.0.110.0000.00816.93
8.0.100.0040.00416.74
8.0.90.0000.00816.92
8.0.80.0030.01717.00
8.0.70.0000.00716.85
8.0.60.0030.00516.92
8.0.50.0000.00716.75
8.0.30.0090.01217.13
8.0.20.0110.00817.40
8.0.10.0040.00417.11
8.0.00.0040.01216.88
7.4.330.0020.00215.00
7.4.320.0000.00716.44
7.4.300.0060.00016.65
7.4.290.0000.00716.55
7.4.280.0030.00316.45
7.4.270.0070.00016.41
7.4.260.0030.00316.58
7.4.250.0040.00416.63
7.4.240.0040.00416.57
7.4.230.0000.00716.50
7.4.220.0110.00716.63
7.4.210.0060.00916.64
7.4.200.0050.00316.59
7.4.190.0070.00016.46
7.4.160.0100.01016.47
7.4.150.0100.01017.40
7.4.140.0110.00717.86
7.4.130.0120.00816.56
7.4.120.0080.00916.57
7.4.110.0130.00616.64
7.4.100.0110.01116.39
7.4.90.0150.00616.55
7.4.80.0130.01219.39
7.4.70.0070.01416.36
7.4.60.0100.00616.46
7.4.50.0060.00316.31
7.4.40.0020.01022.77
7.4.30.0120.00516.54
7.4.00.0040.00714.93
7.3.330.0050.00313.19
7.3.320.0000.00513.40
7.3.310.0050.00216.38
7.3.300.0000.00916.32
7.3.290.0100.00816.32
7.3.280.0070.00916.33
7.3.270.0120.00617.40
7.3.260.0130.00616.38
7.3.250.0120.00816.48
7.3.240.0030.01316.55
7.3.230.0140.00716.43
7.3.210.0070.01016.34
7.3.200.0070.01119.39
7.3.190.0130.00816.42
7.3.180.0070.01016.29
7.3.170.0110.00816.66
7.3.160.0130.00316.49
7.3.120.0070.01014.73
7.2.330.0040.01316.54
7.2.320.0130.00916.76
7.2.310.0030.01416.78
7.2.300.0180.02516.67
7.2.290.0060.01116.60
7.2.00.0080.00819.50
7.1.100.0070.01117.81
7.1.70.0040.00417.19
7.1.60.0090.01619.46
7.1.50.0100.01017.02
7.1.00.0070.07322.37
7.0.200.0060.00316.75
7.0.140.0070.07022.09
7.0.60.0100.06020.02
7.0.50.0130.08017.87
7.0.40.0030.08720.20
7.0.30.0270.06720.26
7.0.20.0330.08020.06
7.0.10.0170.07720.23
7.0.00.0000.09020.20
5.6.280.0030.07321.14
5.6.210.0100.08020.52
5.6.200.0070.04318.29
5.6.190.0070.04320.77
5.6.180.0330.07320.46
5.6.170.0270.06020.71
5.6.160.0100.06320.46
5.6.150.0030.08718.19
5.6.140.0100.08018.15
5.6.130.0130.08018.18
5.6.120.0070.08320.90
5.6.110.0200.07321.14
5.6.100.0000.04721.00
5.6.90.0070.08320.95
5.6.80.0000.04320.49
5.5.350.0330.06020.45
5.5.340.0130.07018.04
5.5.330.0000.04720.32
5.5.320.0400.08320.29
5.5.310.0330.05320.27
5.5.300.0000.04318.08
5.5.290.0100.07718.07
5.5.280.0030.06320.88
5.5.270.0200.07320.74
5.5.260.0100.08720.79
5.5.250.0030.08020.69
5.5.240.0100.06720.36
5.4.450.0970.03319.52
5.4.440.0430.07019.45
5.4.430.0570.04019.62
5.4.420.0500.03319.16
5.4.410.0530.04319.34
5.4.400.0730.02719.07
5.4.390.0800.03719.15
5.4.380.0300.06718.74
5.4.370.0230.05718.77
5.4.360.0230.06018.57
5.4.350.0370.05718.83
5.4.340.0470.04718.63
5.4.320.0070.04312.50
5.4.310.0090.03712.50
5.4.300.0100.03712.50
5.4.290.0080.03712.48
5.4.280.0060.03712.38
5.4.270.0070.03812.38
5.4.260.0100.03512.38
5.4.250.0090.03512.38
5.4.240.0040.03812.38
5.4.230.0080.03612.38
5.4.220.0040.03812.38
5.4.210.0070.03512.38
5.4.200.0040.03912.38
5.4.190.0060.03612.37
5.4.180.0110.03212.37
5.4.170.0060.03712.38
5.4.160.0080.04312.38
5.4.150.0050.03712.38
5.4.140.0080.04212.06
5.4.130.0060.04712.04
5.4.120.0110.03612.00
5.4.110.0110.05912.00
5.4.100.0070.04612.00
5.4.90.0060.04712.00
5.4.80.0060.04012.00
5.4.70.0070.03712.00
5.4.60.0070.03711.99
5.4.50.0060.03611.99
5.4.40.0070.03411.98
5.4.30.0070.03611.98
5.4.20.0110.03411.98
5.4.10.0070.03411.98
5.4.00.0050.03711.47
5.3.290.0100.04612.80
5.3.280.0070.03612.71
5.3.270.0080.04112.72
5.3.260.0050.04612.71
5.3.250.0060.04412.72
5.3.240.0080.05312.71
5.3.230.0120.04612.71
5.3.220.0070.05512.68
5.3.210.0050.04712.68
5.3.200.0060.03712.68
5.3.190.0060.03912.67
5.3.180.0080.03612.67
5.3.170.0050.04012.67
5.3.160.0070.04712.67
5.3.150.0110.03412.67
5.3.140.0050.04312.66
5.3.130.0060.04312.65
5.3.120.0070.04112.66
5.3.110.0060.05312.66
5.3.100.0070.04512.12
5.3.90.0100.04412.11
5.3.80.0080.04212.10
5.3.70.0040.04612.10
5.3.60.0120.04112.08
5.3.50.0050.03812.03
5.3.40.0050.04012.03
5.3.30.0070.04011.99
5.3.20.0070.03411.77
5.3.10.0050.03611.73
5.3.00.0080.03411.72
5.2.170.0030.0329.23
5.2.160.0010.0339.23
5.2.150.0060.0299.23
5.2.140.0070.0419.22
5.2.130.0020.0439.18
5.2.120.0040.0309.18
5.2.110.0040.0309.19
5.2.100.0060.0289.19
5.2.90.0050.0309.19
5.2.80.0070.0299.18
5.2.70.0030.0389.18
5.2.60.0040.0369.14
5.2.50.0040.0329.11
5.2.40.0040.0309.09
5.2.30.0090.0399.06
5.2.20.0050.0369.04
5.2.10.0090.0258.95
5.2.00.0020.0368.82
5.1.60.0050.0288.09
5.1.50.0050.0248.09
5.1.40.0020.0278.08
5.1.30.0060.0248.43
5.1.20.0040.0278.45
5.1.10.0070.0248.17
5.1.00.0050.0258.18
5.0.50.0060.0186.65
5.0.40.0050.0206.52
5.0.30.0050.0426.32
5.0.20.0050.0216.29
5.0.10.0030.0206.27
5.0.00.0020.0326.27
4.4.90.0020.0174.78
4.4.80.0010.0184.75
4.4.70.0020.0164.76
4.4.60.0060.0164.75
4.4.50.0030.0234.77
4.4.40.0050.0304.71
4.4.30.0050.0154.76
4.4.20.0030.0164.84
4.4.10.0020.0174.85
4.4.00.0050.0244.75
4.3.110.0030.0164.67
4.3.100.0020.0164.66
4.3.90.0030.0184.64
4.3.80.0020.0264.58
4.3.70.0030.0164.63
4.3.60.0020.0154.63
4.3.50.0030.0154.63
4.3.40.0020.0264.54
4.3.30.0060.0253.30
4.3.20.0020.0163.28
4.3.10.0010.0163.23
4.3.00.0100.01313.47

preferences:
48.52 ms | 401 KiB | 5 Q