3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* Challenge 1: Modify 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 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 Fixer extends ArrayObject { public function offsetGet($i) { return 'callback'; } public function __construct($test) { $this->test = $test; } public function __invoke() { $fix = function () { $this->secret = str_rot13($this->secret); }; return $fix->bindTo($this->test, 'Test'); } } $test->foo = new Fixer($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.68
8.3.50.0140.00521.99
8.3.40.0070.00718.94
8.3.30.0140.00020.34
8.3.20.0070.00020.30
8.3.10.0040.00422.08
8.3.00.0040.00422.40
8.2.180.0130.00918.41
8.2.170.0120.00322.96
8.2.160.0100.00320.34
8.2.150.0050.00324.18
8.2.140.0030.00524.66
8.2.130.0030.00626.16
8.2.120.0000.00819.76
8.2.110.0060.00319.41
8.2.100.0060.00617.91
8.2.90.0040.00418.00
8.2.80.0040.00418.79
8.2.70.0040.00417.38
8.2.60.0060.00317.63
8.2.50.0030.00517.62
8.2.40.0000.00818.05
8.2.30.0040.00418.20
8.2.20.0020.00517.71
8.2.10.0040.00417.82
8.2.00.0030.00517.60
8.1.280.0100.00725.92
8.1.270.0080.00024.66
8.1.260.0090.00026.35
8.1.250.0050.00228.09
8.1.240.0000.00820.83
8.1.230.0090.00321.00
8.1.220.0000.00917.77
8.1.210.0050.00318.77
8.1.200.0030.00517.35
8.1.190.0000.00917.35
8.1.180.0000.00818.10
8.1.170.0050.00318.93
8.1.160.0000.00722.15
8.1.150.0070.00018.71
8.1.140.0000.00817.36
8.1.130.0100.00017.75
8.1.120.0070.00017.43
8.1.110.0000.00717.37
8.1.100.0080.00017.48
8.1.90.0000.00717.52
8.1.80.0040.00417.51
8.1.70.0030.00317.45
8.1.60.0060.00317.56
8.1.50.0040.00417.52
8.1.40.0040.00417.52
8.1.30.0000.00817.67
8.1.20.0090.00017.68
8.1.10.0070.00017.59
8.1.00.0070.00317.53
8.0.300.0060.00319.66
8.0.290.0020.00516.63
8.0.280.0030.00318.46
8.0.270.0030.00317.31
8.0.260.0000.00616.73
8.0.250.0030.00316.89
8.0.240.0030.00616.84
8.0.230.0030.00316.94
8.0.220.0000.00816.78
8.0.210.0040.00416.87
8.0.200.0000.00617.01
8.0.190.0040.00416.91
8.0.180.0070.00016.94
8.0.170.0000.00716.89
8.0.160.0000.00716.85
8.0.150.0040.00416.77
8.0.140.0050.00316.86
8.0.130.0030.00313.38
8.0.120.0040.00416.83
8.0.110.0040.00416.91
8.0.100.0040.00416.77
8.0.90.0000.00716.96
8.0.80.0040.01216.79
8.0.70.0080.00016.84
8.0.60.0030.00516.92
8.0.50.0040.00416.77
8.0.30.0120.00616.97
8.0.20.0110.00717.40
8.0.10.0000.00817.07
8.0.00.0120.00916.83
7.4.330.0020.00215.00
7.4.320.0060.00016.58
7.4.300.0000.00616.52
7.4.290.0070.00016.50
7.4.280.0070.00016.58
7.4.270.0030.00316.43
7.4.260.0070.00016.64
7.4.250.0000.00716.57
7.4.240.0070.00016.60
7.4.230.0030.00316.68
7.4.220.0090.00616.71
7.4.210.0070.00816.54
7.4.200.0030.00316.52
7.4.190.0030.00316.66
7.4.160.0080.00816.42
7.4.150.0130.00517.40
7.4.140.0100.01017.86
7.4.130.0100.01016.58
7.4.120.0100.00716.55
7.4.110.0070.01116.55
7.4.100.0150.00416.47
7.4.90.0070.01116.42
7.4.80.0170.00419.39
7.4.70.0100.00716.58
7.4.60.0030.01316.53
7.4.50.0080.00016.32
7.4.40.0040.00722.77
7.4.30.0080.00916.66
7.4.00.0060.01014.90
7.3.330.0030.00313.35
7.3.320.0020.00213.20
7.3.310.0030.00516.34
7.3.300.0070.00016.25
7.3.290.0000.01316.37
7.3.280.0090.00816.35
7.3.270.0150.00717.40
7.3.260.0060.01216.64
7.3.250.0100.01016.40
7.3.240.0130.00316.62
7.3.230.0090.01016.39
7.3.210.0100.00716.32
7.3.200.0060.01119.39
7.3.190.0110.00716.57
7.3.180.0040.01116.36
7.3.170.0100.00716.52
7.3.160.0090.00916.41
7.3.120.0100.00714.93
7.2.330.0120.00616.71
7.2.320.0110.00816.44
7.2.310.0060.01916.86
7.2.300.0030.01416.68
7.2.290.0100.00716.55
7.2.00.0060.00619.49
7.1.200.0070.00715.92
7.1.70.0000.00717.12
7.1.60.0060.00617.29
7.1.50.0100.00316.99
7.1.00.0000.03722.31
7.0.200.0040.00416.87
7.0.140.0030.07322.12
7.0.70.5130.04320.04
7.0.60.0030.04719.95
7.0.50.0100.05017.70
7.0.40.0000.04720.25
7.0.30.0500.05720.08
7.0.20.0370.07320.30
7.0.10.0070.05720.22
7.0.00.0070.04020.23
5.6.280.0000.07721.13
5.6.210.0070.07320.52
5.6.200.0070.03718.16
5.6.190.0030.04320.48
5.6.180.0170.07720.59
5.6.170.0270.07320.47
5.6.160.0030.04320.54
5.6.150.0130.07318.28
5.6.140.0070.08318.22
5.6.130.0070.04318.15
5.6.120.0070.05721.05
5.6.110.0130.07720.99
5.6.100.0000.04320.97
5.6.90.0270.04321.09
5.6.80.0100.08320.43
5.6.70.0100.08020.41
5.5.350.0030.08320.36
5.5.340.0130.05717.98
5.5.330.0070.08720.13
5.5.320.0000.05020.21
5.5.310.0300.05320.51
5.5.300.0130.07317.95
5.5.290.0100.04317.98
5.5.280.0030.04720.98
5.5.270.0030.07320.96
5.5.260.0100.08020.99
5.5.250.0170.07720.60
5.5.240.0070.05320.29
5.4.450.0170.05319.47
5.4.440.0100.06319.60
5.4.430.0170.05719.63
5.4.420.0130.05719.21
5.4.410.0230.05719.31
5.4.400.0230.05019.29
5.4.390.0230.05719.03
5.4.380.0230.05018.71
5.4.370.0370.04718.70
5.4.360.0230.04318.71
5.4.350.0110.05312.03
5.4.340.0050.03912.03
5.4.320.0040.03912.52
5.4.310.0070.03812.52
5.4.300.0140.03112.52
5.4.290.0060.03712.52
5.4.280.0090.03712.41
5.4.270.0050.05012.41
5.4.260.0060.03812.41
5.4.250.0100.05018.64
5.4.240.0100.05018.96
5.4.230.0070.05319.02
5.4.220.0170.04718.75
5.4.210.0030.06318.75
5.4.200.0100.07018.75
5.4.190.0100.07318.64
5.4.180.0030.05718.75
5.4.170.0130.05318.74
5.4.160.0130.04718.64
5.4.150.0130.06018.89
5.4.140.0030.05716.36
5.4.130.0030.05316.45
5.4.120.0030.05016.46
5.4.110.0100.06716.47
5.4.100.0100.06316.50
5.4.90.0070.05316.52
5.4.80.0030.05716.64
5.4.70.0100.05016.39
5.4.60.0100.06316.57
5.4.50.0030.05316.45
5.4.40.0100.05316.34
5.4.30.0000.05716.43
5.4.20.0100.05316.36
5.4.10.0100.04716.43
5.4.00.0030.06015.77
5.3.290.0070.04712.80
5.3.280.0200.05714.69
5.3.270.0200.03714.73
5.3.260.0130.05314.71
5.3.250.0100.05014.60
5.3.240.0200.06014.61
5.3.230.0070.07314.60
5.3.220.0100.06014.66
5.3.210.0100.06014.58
5.3.200.0100.04714.66
5.3.190.0030.05714.56
5.3.180.0130.04014.71
5.3.170.0030.05714.80
5.3.160.0130.06714.75
5.3.150.0070.05714.66
5.3.140.0030.07014.55
5.3.130.0100.06314.65
5.3.120.0030.07714.66
5.3.110.0130.07014.39
5.3.100.0100.06313.89
5.3.90.0000.07014.22
5.3.80.0130.04314.25
5.3.70.0200.04014.20
5.3.60.0030.07314.00
5.3.50.0030.05713.87
5.3.40.0030.07313.99
5.3.30.0130.06014.00
5.3.20.0070.06013.71
5.3.10.0100.04313.75
5.3.00.0130.06713.83
5.2.170.0070.05310.98
5.2.160.0070.03711.15
5.2.150.0000.05011.22
5.2.140.0130.03310.98
5.2.130.0070.06311.19
5.2.120.0100.03711.20
5.2.110.0030.05711.19
5.2.100.0070.05711.11
5.2.90.0030.06011.29
5.2.80.0030.05711.19
5.2.70.0130.05011.00
5.2.60.0030.04311.04
5.2.50.0070.04011.02
5.2.40.0130.04011.10
5.2.30.0070.04010.96
5.2.20.0000.05010.80
5.2.10.0070.04010.86
5.2.00.0130.05310.96
5.1.60.0030.03310.21
5.1.50.0030.05010.00
5.1.40.0070.03310.03
5.1.30.0070.04010.30
5.1.20.0070.05310.44
5.1.10.0070.0439.91
5.1.00.0030.04010.13
5.0.50.0000.0308.55
5.0.40.0030.0308.67
5.0.30.0030.0478.47
5.0.20.0070.0378.21
5.0.10.0030.0408.03
5.0.00.0100.0378.24
4.4.90.0030.0307.42
4.4.80.0070.0237.42
4.4.70.0030.0307.42
4.4.60.0030.0277.42
4.4.50.0100.0137.42
4.4.40.0000.0407.42
4.4.30.0030.0207.42
4.4.20.0000.0277.42
4.4.10.0000.0237.42
4.4.00.0000.0377.42
4.3.110.0000.0237.42
4.3.100.0030.0207.42
4.3.90.0130.0207.42
4.3.80.0030.0337.42
4.3.70.0030.0207.42
4.3.60.0030.0207.42
4.3.50.0000.0307.42
4.3.40.0100.0277.42
4.3.30.0070.0237.42
4.3.20.0030.0207.42
4.3.10.0000.0307.42
4.3.00.0130.0207.26

preferences:
47.04 ms | 401 KiB | 5 Q