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 A implements ArrayAccess { private $callCount = 0; public function __call($name, $args){ return function(){ echo "HELLO WORLD"; }; } public function offsetSet($offset, $value) {} public function offsetExists($offset) { return true; } public function offsetUnset($offset) {} public function offsetGet($offset) { $this->callCount++; if ($this->callCount == 1){ return $this; } else { return "FOO"; } } } $test->foo = new A; // 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.0080.00818.18
8.3.60.0120.00318.41
8.3.50.0120.00721.02
8.3.40.0070.01018.71
8.3.30.0120.00320.34
8.3.20.0070.00020.21
8.3.10.0060.00321.95
8.3.00.0030.00522.40
8.2.190.0140.00716.88
8.2.180.0090.00916.63
8.2.170.0120.00622.96
8.2.160.0100.00320.57
8.2.150.0080.00024.18
8.2.140.0030.00624.66
8.2.130.0110.00426.16
8.2.120.0040.00419.54
8.2.110.0070.00322.16
8.2.100.0080.00419.32
8.2.90.0000.00819.39
8.2.80.0030.00519.21
8.2.70.0040.00417.75
8.2.60.0040.00718.05
8.2.50.0040.00418.07
8.2.40.0050.00318.34
8.2.30.0040.00418.16
8.2.20.0000.00717.91
8.2.10.0050.00317.79
8.2.00.0000.00817.84
8.1.280.0110.00425.92
8.1.270.0080.00024.66
8.1.260.0030.00626.35
8.1.250.0060.00328.09
8.1.240.0040.00423.92
8.1.230.0070.00418.99
8.1.220.0030.00717.78
8.1.210.0000.00818.77
8.1.200.0000.00917.36
8.1.190.0040.00417.40
8.1.180.0040.00420.19
8.1.170.0000.00818.29
8.1.160.0040.00422.23
8.1.150.0060.00318.77
8.1.140.0070.00017.41
8.1.130.0030.00517.89
8.1.120.0030.00517.48
8.1.110.0040.00417.36
8.1.100.0040.00417.45
8.1.90.0040.00417.50
8.1.80.0060.00317.38
8.1.70.0000.00717.39
8.1.60.0030.00717.61
8.1.50.0080.00017.57
8.1.40.0040.00417.52
8.1.30.0080.00017.66
8.1.20.0000.00817.72
8.1.10.0000.00817.53
8.1.00.0060.00617.51
8.0.300.0030.00418.77
8.0.290.0000.00817.16
8.0.280.0030.00318.48
8.0.270.0000.00717.20
8.0.260.0030.00316.91
8.0.250.0030.00317.05
8.0.240.0110.00017.05
8.0.230.0000.00717.05
8.0.220.0070.00016.86
8.0.210.0030.00316.88
8.0.200.0030.00316.96
8.0.190.0040.00417.09
8.0.180.0040.00416.99
8.0.170.0000.00917.06
8.0.160.0030.00317.11
8.0.150.0040.00416.98
8.0.140.0040.00416.94
8.0.130.0000.00613.45
8.0.120.0050.00316.82
8.0.110.0000.00817.02
8.0.100.0040.00417.06
8.0.90.0040.00416.86
8.0.80.0040.01216.86
8.0.70.0040.00416.80
8.0.60.0040.00416.93
8.0.50.0000.00716.95
8.0.30.0180.00417.30
8.0.20.0100.00917.46
8.0.10.0050.00317.05
8.0.00.0020.01816.89
7.4.330.0000.00515.00
7.4.320.0050.00216.61
7.4.300.0000.00616.63
7.4.290.0030.00316.43
7.4.280.0000.00716.52
7.4.270.0030.00316.54
7.4.260.0000.00716.54
7.4.250.0030.00316.59
7.4.240.0050.00216.59
7.4.230.0040.00416.42
7.4.220.0130.01016.65
7.4.210.0090.00716.63
7.4.200.0000.00716.38
7.4.190.0030.00316.59
7.4.160.0080.00816.50
7.4.150.0130.00317.40
7.4.140.0060.01317.86
7.4.130.0040.01516.60
7.4.120.0080.00916.59
7.4.110.0090.00616.52
7.4.100.0140.00516.70
7.4.90.0030.01316.69
7.4.80.0000.02219.39
7.4.70.0090.00916.43
7.4.60.0100.00616.48
7.4.50.0070.00016.65
7.4.40.0000.01222.77
7.4.30.0070.01016.38
7.4.00.0000.01215.09
7.3.330.0050.00013.32
7.3.320.0030.00313.40
7.3.310.0070.00016.27
7.3.300.0030.00316.45
7.3.290.0030.01516.37
7.3.280.0020.01316.41
7.3.270.0110.00817.40
7.3.260.0160.00716.46
7.3.250.0150.00916.61
7.3.240.0110.00716.36
7.3.230.0030.01416.59
7.3.210.0030.01416.61
7.3.200.0070.01719.39
7.3.190.0070.01016.51
7.3.180.0070.01016.49
7.3.170.0140.00316.41
7.3.160.0070.00716.53
7.3.120.0000.01414.90
7.2.330.0120.00616.83
7.2.320.0140.00316.66
7.2.310.0170.00616.50
7.2.300.0110.00616.77
7.2.290.0070.01016.64
7.2.60.0090.00316.68
7.2.00.0030.00719.24
7.1.200.0100.00315.84
7.1.100.0090.00618.13
7.1.70.0060.00617.06
7.1.60.0100.01419.21
7.1.50.0130.00917.01
7.1.00.0030.04322.45
7.0.200.0220.00314.84
7.0.140.0070.09022.09
7.0.60.0070.07319.84
7.0.50.0170.04017.90
7.0.40.0000.08020.11
7.0.30.0470.05720.34
7.0.20.0200.06320.26
7.0.10.0100.05020.23
7.0.00.0200.06020.22
5.6.280.0030.04721.08
5.6.210.0030.06320.71
5.6.200.0070.07018.13
5.6.190.0070.06320.61
5.6.180.0270.05320.46
5.6.170.0330.08020.70
5.6.160.0030.06320.48
5.6.150.0130.06718.14
5.6.140.0070.07718.23
5.6.130.0100.08318.23
5.6.120.0100.03721.00
5.6.110.0100.08320.98
5.6.100.0070.06021.00
5.6.90.0070.08721.00
5.6.80.0100.03320.42
5.6.70.4330.04720.36
5.5.350.0070.06320.46
5.5.340.0030.05018.01
5.5.330.0030.08020.42
5.5.320.0170.04020.32
5.5.310.0270.07320.26
5.5.300.0030.03717.97
5.5.290.0100.08018.06
5.5.280.0100.08320.79
5.5.270.0100.06720.89
5.5.260.0070.05320.66
5.5.250.0100.07020.59
5.5.240.0000.08320.28
5.4.450.1000.05719.47
5.4.440.0930.07019.48
5.4.430.0730.05019.69
5.4.420.0770.06019.33
5.4.410.1100.08019.57
5.4.400.0370.05718.77
5.4.390.0370.05718.60
5.4.380.0270.04718.75
5.4.370.0130.05018.52
5.4.360.0130.05018.75
5.4.350.0080.03312.03
5.4.340.0090.04012.03
5.4.320.0060.03812.52
5.4.310.0060.04312.52
5.4.300.0070.03812.52
5.4.290.0090.03412.51
5.4.280.0110.03612.41
5.4.270.0040.03712.41
5.4.260.0090.03412.41
5.4.250.0130.05319.09
5.4.240.0030.08718.79
5.4.230.0170.06718.93
5.4.220.0130.05718.97
5.4.210.0100.07318.83
5.4.200.0170.05719.09
5.4.190.0130.04718.65
5.4.180.0000.08319.02
5.4.170.0130.07318.99
5.4.160.0030.05718.95
5.4.150.0130.05718.92
5.4.140.0000.07716.67
5.4.130.0070.05016.44
5.4.120.0100.05316.64
5.4.110.0130.07016.38
5.4.100.0200.04016.54
5.4.90.0230.03716.55
5.4.80.0030.06016.41
5.4.70.0070.05716.54
5.4.60.0100.05716.49
5.4.50.0030.05716.59
5.4.40.0100.05016.68
5.4.30.0030.05716.62
5.4.20.0030.07716.44
5.4.10.0130.05016.44
5.4.00.0230.05016.02
5.3.290.0040.04012.80
5.3.280.0130.06314.44
5.3.270.0070.06314.78
5.3.260.0130.05314.77
5.3.250.0030.06714.71
5.3.240.0100.05714.61
5.3.230.0030.05314.70
5.3.220.0070.05314.81
5.3.210.0000.06014.61
5.3.200.0200.04314.57
5.3.190.0100.04714.56
5.3.180.0130.05014.76
5.3.170.0100.05314.41
5.3.160.0200.04714.80
5.3.150.0170.04314.60
5.3.140.0130.06014.48
5.3.130.0070.06314.54
5.3.120.0030.08014.75
5.3.110.0070.08014.63
5.3.100.0100.05314.12
5.3.90.0070.05714.05
5.3.80.0070.05314.02
5.3.70.0030.08014.05
5.3.60.0170.04714.10
5.3.50.0030.06713.80
5.3.40.0200.06014.01
5.3.30.0070.04713.94
5.3.20.0130.05313.79
5.3.10.0130.06313.73
5.3.00.0030.06013.64
5.2.170.0070.04311.38
5.2.160.0130.05011.05
5.2.150.0100.05711.16
5.2.140.0070.04011.22
5.2.130.0170.05011.02
5.2.120.0100.04711.20
5.2.110.0030.04711.18
5.2.100.0070.03711.32
5.2.90.0100.04011.01
5.2.80.0030.05711.32
5.2.70.0000.05010.93
5.2.60.0130.03710.96
5.2.50.0070.04011.11
5.2.40.0030.04011.09
5.2.30.0200.03710.93
5.2.20.0070.04310.95
5.2.10.0130.04310.86
5.2.00.0100.04010.56
5.1.60.0070.03010.24
5.1.50.0030.03710.24
5.1.40.0030.03310.24
5.1.30.0030.03710.57
5.1.20.0100.03310.43
5.1.10.0030.03710.28
5.1.00.0030.03310.24
5.0.50.0030.03310.24
5.0.40.0070.02710.24
5.0.30.0000.04710.24
5.0.20.0030.03710.24
5.0.10.0030.03710.24
5.0.00.0000.04310.24
4.4.90.0000.02710.24
4.4.80.0000.02310.24
4.4.70.0030.02710.24
4.4.60.0070.02310.24
4.4.50.0030.02310.24
4.4.40.0030.03310.24
4.4.30.0030.02710.24
4.4.20.0000.03310.24
4.4.10.0070.02310.24
4.4.00.0030.03310.24
4.3.110.0030.02010.24
4.3.100.0070.01710.24
4.3.90.0070.02310.24
4.3.80.0000.04310.24
4.3.70.0030.03010.24
4.3.60.0030.02010.24
4.3.50.0000.02310.24
4.3.40.0000.03310.24
4.3.30.0100.01710.24
4.3.20.0000.03010.24
4.3.10.0000.03010.24
4.3.00.0100.0205.78

preferences:
23.86 ms | 401 KiB | 5 Q