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; print_r($array ); } } $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.0120.00318.66
8.3.50.0120.00322.03
8.3.40.0100.01018.88
8.3.30.0110.00418.79
8.3.20.0110.00420.16
8.3.10.0080.00023.48
8.3.00.0150.00419.50
8.2.180.0040.01818.54
8.2.170.0120.00922.96
8.2.160.0070.01320.39
8.2.150.0040.00424.18
8.2.140.0030.01024.66
8.2.130.0090.00526.16
8.2.120.0070.00722.15
8.2.110.0090.00022.13
8.2.100.0080.00417.91
8.2.90.0040.00419.09
8.2.80.0000.00817.97
8.2.70.0000.00817.63
8.2.60.0070.00717.55
8.2.50.0090.00018.07
8.2.40.0000.00819.95
8.2.30.0060.00318.00
8.2.20.0000.00717.61
8.2.10.0080.00017.99
8.2.00.0040.00417.72
8.1.280.0160.00725.92
8.1.270.0030.00522.07
8.1.260.0040.00426.35
8.1.250.0030.00528.09
8.1.240.0050.00523.59
8.1.230.0070.00319.10
8.1.220.0050.00317.74
8.1.210.0050.00418.77
8.1.200.0030.00617.23
8.1.190.0080.00017.53
8.1.180.0060.00318.10
8.1.170.0060.00618.52
8.1.160.0030.00321.84
8.1.150.0030.00718.48
8.1.140.0040.00417.43
8.1.130.0070.00017.75
8.1.120.0050.00317.29
8.1.110.0070.00417.36
8.1.100.0030.00417.29
8.1.90.0000.00817.40
8.1.80.0000.00717.40
8.1.70.0000.00717.34
8.1.60.0000.00717.59
8.1.50.0050.00317.55
8.1.40.0040.00417.48
8.1.30.0040.00417.65
8.1.20.0000.00717.63
8.1.10.0050.00317.45
8.1.00.0070.00017.39
8.0.300.0000.00719.21
8.0.290.0040.00417.05
8.0.280.0040.00418.40
8.0.270.0050.00317.11
8.0.260.0040.00417.15
8.0.250.0000.00716.88
8.0.240.0060.00316.86
8.0.230.0020.00516.86
8.0.220.0030.00316.79
8.0.210.0070.00316.80
8.0.200.0000.00616.94
8.0.190.0000.00816.93
8.0.180.0000.01016.81
8.0.170.0050.00316.82
8.0.160.0050.00316.86
8.0.150.0000.00716.80
8.0.140.0000.00716.89
8.0.130.0000.00513.41
8.0.120.0040.00416.95
8.0.110.0080.00016.89
8.0.100.0040.00416.78
8.0.90.0030.00516.81
8.0.80.0130.00916.89
8.0.70.0050.00216.84
8.0.60.0000.00716.94
8.0.50.0000.00716.77
8.0.30.0100.01216.91
8.0.20.0140.00517.40
8.0.10.0070.00016.82
8.0.00.0080.00916.68
7.4.330.0000.00515.00
7.4.320.0040.00416.58
7.4.300.0070.00016.57
7.4.290.0000.00816.60
7.4.280.0000.00716.51
7.4.270.0000.00816.49
7.4.260.0030.00316.56
7.4.250.0000.00816.48
7.4.240.0040.00416.56
7.4.230.0070.00016.30
7.4.220.0070.01116.56
7.4.210.0100.00416.64
7.4.200.0070.00016.53
7.4.190.0030.00316.46
7.4.160.0030.01316.51
7.4.150.0080.01517.40
7.4.140.0050.01317.86
7.4.130.0100.01016.57
7.4.120.0050.01416.54
7.4.110.0150.00616.57
7.4.100.0130.00616.55
7.4.90.0070.01116.56
7.4.80.0120.00919.39
7.4.70.0090.00916.34
7.4.60.0060.01216.34
7.4.50.0020.00216.34
7.4.40.0040.01122.77
7.4.30.0030.01416.73
7.4.00.0080.00615.11
7.3.330.0000.00713.23
7.3.320.0030.00313.26
7.3.310.0070.00016.47
7.3.300.0030.00616.32
7.3.290.0090.00416.36
7.3.280.0060.01316.37
7.3.270.0050.01317.40
7.3.260.0120.00616.61
7.3.250.0090.01116.48
7.3.240.0150.00316.40
7.3.230.0100.00716.53
7.3.210.0060.01616.37
7.3.200.0070.01319.39
7.3.190.0030.01316.39
7.3.180.0090.01316.45
7.3.170.0160.00316.44
7.3.160.0100.00716.41
7.3.120.0070.00714.67
7.2.330.0070.01016.77
7.2.320.0090.00916.62
7.2.310.0100.00716.91
7.2.300.0090.00916.54
7.2.290.0140.00716.87
7.2.00.0090.00619.32
7.1.100.0090.00917.54
7.1.70.0070.00717.19
7.1.60.0100.01319.46
7.1.50.0110.01516.88
7.1.00.0000.07722.45
7.0.200.0060.00316.58
7.0.140.0030.09022.21
7.0.60.0200.07721.86
7.0.50.0030.04017.89
7.0.40.0070.04020.20
7.0.30.0130.04720.20
7.0.20.0230.07320.08
7.0.10.0030.04320.10
7.0.00.0100.06720.25
5.6.280.0070.07021.16
5.6.210.0070.08320.73
5.6.200.0030.09018.16
5.6.190.0030.05020.48
5.6.180.0400.07320.77
5.6.170.0270.05320.47
5.6.160.0130.05720.51
5.6.150.0170.07318.20
5.6.140.0130.07018.18
5.6.130.0030.06318.16
5.6.120.0170.04321.13
5.6.110.0170.07020.98
5.6.100.0070.07021.04
5.6.90.0070.08720.89
5.6.80.0100.07720.50
5.5.350.0200.07320.39
5.5.340.0030.07717.99
5.5.330.0070.04320.40
5.5.320.0230.03720.25
5.5.310.0300.04720.32
5.5.300.0000.04017.93
5.5.290.0130.07317.98
5.5.280.0000.05320.88
5.5.270.0100.04720.98
5.5.260.0170.07320.73
5.5.250.0030.04320.69
5.5.240.1300.04320.35
5.4.450.3870.03319.53
5.4.440.0000.06719.31
5.4.430.1570.04319.29
5.4.420.3800.03719.33
5.4.410.3870.03019.30
5.4.400.4130.03319.22
5.4.390.4170.03319.20
5.4.380.3770.03718.95
5.4.370.3830.03719.21
5.4.360.4700.04019.04
5.4.350.3830.03319.26
5.4.340.3630.04019.11
5.4.320.4170.04318.95
5.4.310.4200.03719.12
5.4.300.4070.03318.94
5.4.290.4230.04019.20
5.4.280.3770.03319.19
5.4.270.3830.03718.93
5.4.260.4030.03319.05
5.4.250.4500.04319.20
5.4.240.4470.04318.92
5.4.230.4400.04019.16
5.4.220.4170.04019.23
5.4.210.3900.03719.14
5.4.200.3870.04018.93
5.4.190.4000.03719.06
5.4.180.3570.03319.23
5.4.170.4200.02718.92
5.4.160.4170.03319.02
5.4.150.3600.03018.91
5.4.140.4400.04316.44
5.4.130.4030.03716.45
5.4.120.3100.04016.43
5.4.110.2770.03716.27
5.4.100.2830.04016.59
5.4.90.3670.04016.49
5.4.80.2770.03316.67
5.4.70.3430.03316.48
5.4.60.3170.03316.43
5.4.50.3470.03316.20
5.4.40.2600.03016.45
5.4.30.2470.04016.60
5.4.20.3970.03316.53
5.4.10.5530.02716.42
5.4.00.3930.04015.79
5.3.290.4000.03714.74
5.3.280.3770.03714.61
5.3.270.4030.04014.63
5.3.260.4400.04014.63
5.3.250.4330.03714.66
5.3.240.4230.04714.53
5.3.230.3900.03314.61
5.3.220.1500.03314.58
5.3.210.2800.04714.63
5.3.200.2770.04014.56
5.3.190.2970.03714.49
5.3.180.3070.04014.62
5.3.170.2430.03314.61
5.3.160.2600.03314.46
5.3.150.2400.04014.63
5.3.140.2570.04014.71
5.3.130.3030.04014.44
5.3.120.3900.04014.56
5.3.110.3770.03714.60
5.3.100.4130.04014.06
5.3.90.3970.04314.02
5.3.80.3800.03714.10
5.3.70.3900.04013.94
5.3.60.3370.03014.06
5.3.50.3870.03013.98
5.3.40.4270.02714.02
5.3.30.3570.03713.97
5.3.20.4100.03013.63
5.3.10.4100.03313.66
5.3.00.4130.03713.68
5.2.170.3230.02311.19
5.2.160.3600.02711.21
5.2.150.3470.03011.12
5.2.140.3470.02711.19
5.2.130.3100.02711.09
5.2.120.3100.03311.08
5.2.110.3200.02311.18
5.2.100.3270.03011.18
5.2.90.3130.03011.00
5.2.80.3900.03311.14
5.2.70.4130.03311.14
5.2.60.4070.02711.02
5.2.50.4030.03710.99
5.2.40.3300.03011.00
5.2.30.3270.03311.02
5.2.20.3030.03011.11
5.2.10.3300.02710.83
5.2.00.2630.03010.78
5.1.60.2930.0279.97
5.1.50.2230.02710.06
5.1.40.3400.02310.01
5.1.30.4000.02710.40
5.1.20.2830.02710.36
5.1.10.2330.02710.05
5.1.00.2700.0279.98
5.0.50.1230.0238.71
5.0.40.1800.0238.40
5.0.30.1900.0238.25
5.0.20.1430.0208.16
5.0.10.2070.0208.18
5.0.00.1830.0308.17
4.4.90.1770.0135.91
4.4.80.1500.0105.81
4.4.70.1630.0175.80
4.4.60.1600.0135.84
4.4.50.1570.0135.88
4.4.40.1530.0305.81
4.4.30.1630.0175.93
4.4.20.1630.0135.94
4.4.10.1470.0135.95
4.4.00.1430.0235.88
4.3.110.2100.0175.77
4.3.100.1600.0075.80
4.3.90.1730.0135.75
4.3.80.1470.0275.80
4.3.70.1930.0105.68
4.3.60.1570.0135.74
4.3.50.1570.0135.80
4.3.40.1630.0205.72
4.3.30.0900.0205.15
4.3.20.0900.0135.15
4.3.10.0830.0135.15
4.3.00.0770.0175.15

preferences:
43.52 ms | 401 KiB | 5 Q