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 { 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) { if (is_object($offset)){ $r = "a"; } else { $r = $this; } } } $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.60.0070.00718.56
8.3.50.0110.00821.09
8.3.40.0120.00918.96
8.3.30.0070.00720.20
8.3.20.0000.00820.25
8.3.10.0030.00622.06
8.3.00.0060.00322.24
8.2.180.0090.00916.63
8.2.170.0120.00322.96
8.2.160.0080.00620.32
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0060.00326.16
8.2.120.0050.00319.66
8.2.110.0060.00322.24
8.2.100.0080.00317.91
8.2.90.0000.00817.85
8.2.80.0000.00917.97
8.2.70.0030.00517.75
8.2.60.0040.00417.93
8.2.50.0030.00518.07
8.2.40.0090.00018.34
8.2.30.0000.00718.05
8.2.20.0000.00817.81
8.2.10.0030.00517.89
8.2.00.0000.00717.82
8.1.280.0100.00725.92
8.1.270.0030.00620.40
8.1.260.0080.00026.35
8.1.250.0050.00228.09
8.1.240.0000.00922.52
8.1.230.0060.00622.50
8.1.220.0060.00317.79
8.1.210.0000.00818.85
8.1.200.0040.00417.35
8.1.190.0000.00817.30
8.1.180.0050.00318.81
8.1.170.0040.00418.52
8.1.160.0000.00722.22
8.1.150.0060.00318.58
8.1.140.0040.00417.50
8.1.130.0000.00717.84
8.1.120.0000.00717.40
8.1.110.0040.00417.52
8.1.100.0040.00417.43
8.1.90.0000.00717.37
8.1.80.0000.00717.50
8.1.70.0040.00417.45
8.1.60.0000.00917.60
8.1.50.0050.00217.55
8.1.40.0000.00817.42
8.1.30.0040.00417.55
8.1.20.0080.00017.53
8.1.10.0000.00717.60
8.1.00.0040.00417.57
8.0.300.0040.00419.90
8.0.290.0000.00717.05
8.0.280.0030.00318.52
8.0.270.0030.00317.19
8.0.260.0000.00816.82
8.0.250.0030.00416.94
8.0.240.0030.00616.92
8.0.230.0070.00017.03
8.0.220.0040.00416.87
8.0.210.0000.00716.87
8.0.200.0000.00616.93
8.0.190.0030.00616.94
8.0.180.0030.00516.86
8.0.170.0040.00416.90
8.0.160.0030.00316.94
8.0.150.0030.00317.01
8.0.140.0000.00716.93
8.0.130.0060.00013.39
8.0.120.0030.00516.84
8.0.110.0000.00816.88
8.0.100.0000.00716.94
8.0.90.0080.00016.97
8.0.80.0160.00316.95
8.0.70.0030.00516.85
8.0.60.0000.00716.85
8.0.50.0040.00416.89
8.0.30.0100.01017.11
8.0.20.0080.01617.40
8.0.10.0100.00017.20
8.0.00.0090.01016.75
7.4.330.0020.00215.00
7.4.320.0070.00016.64
7.4.300.0060.00016.43
7.4.290.0070.00016.53
7.4.280.0070.00016.64
7.4.270.0030.00616.66
7.4.260.0060.00316.61
7.4.250.0000.00816.51
7.4.240.0030.00516.53
7.4.230.0070.00016.63
7.4.220.0060.01316.40
7.4.210.0050.01016.53
7.4.200.0030.00316.53
7.4.190.0070.00016.66
7.4.160.0100.01016.61
7.4.150.0150.00917.40
7.4.140.0100.01017.86
7.4.130.0150.00716.59
7.4.120.0090.00916.57
7.4.110.0120.00616.63
7.4.100.0140.00316.61
7.4.90.0150.00616.64
7.4.80.0110.01119.39
7.4.70.0110.01116.71
7.4.60.0140.00616.67
7.4.50.0040.00016.37
7.4.40.0120.00622.77
7.4.30.0100.00716.50
7.4.00.0070.00714.73
7.3.330.0030.00313.45
7.3.320.0030.00313.41
7.3.310.0000.00716.24
7.3.300.0000.00716.26
7.3.290.0060.00916.34
7.3.280.0110.00816.34
7.3.270.0070.01117.40
7.3.260.0030.01316.56
7.3.250.0120.01216.50
7.3.240.0150.00616.59
7.3.230.0170.00616.39
7.3.210.0100.00716.50
7.3.200.0100.00719.39
7.3.190.0160.00016.50
7.3.180.0060.01116.53
7.3.170.0140.00616.42
7.3.160.0090.00616.38
7.3.120.0070.00714.90
7.2.330.0030.01416.83
7.2.320.0040.01616.77
7.2.310.0090.01016.82
7.2.300.0090.00616.91
7.2.290.0100.01316.44
7.2.60.0030.01017.11
7.2.00.0070.01019.45
7.1.200.0110.00015.84
7.1.100.0080.00418.24
7.1.70.0050.00317.16
7.1.60.0090.01619.40
7.1.50.0070.00716.90
7.1.00.0030.06722.36
7.0.200.0180.00014.95
7.0.140.0000.07722.12
7.0.60.0270.06719.95
7.0.50.0100.05717.88
7.0.40.0030.05720.27
7.0.30.0270.05720.30
7.0.20.0400.07320.23
7.0.10.0200.05320.30
7.0.00.0230.05320.22
5.6.280.0000.07720.94
5.6.210.0070.08020.49
5.6.200.0070.08018.16
5.6.190.0100.08720.61
5.6.180.3730.03320.48
5.6.170.0200.05020.52
5.6.160.0030.04320.55
5.6.150.0070.03718.15
5.6.140.0030.04018.18
5.6.130.0130.06018.14
5.6.120.0130.08021.00
5.6.110.0130.05020.91
5.6.100.0100.08721.14
5.6.90.0070.08320.96
5.6.80.0200.06720.55
5.6.70.0230.07320.37
5.5.350.0130.08020.46
5.5.340.0070.06718.08
5.5.330.0070.05720.40
5.5.320.0030.05320.52
5.5.310.0300.06020.22
5.5.300.0100.08018.07
5.5.290.0130.06317.98
5.5.280.0130.08020.82
5.5.270.0170.07720.78
5.5.260.0030.05320.74
5.5.250.0000.04320.81
5.5.240.0130.07320.06
5.4.450.0270.05319.49
5.4.440.0270.07719.48
5.4.430.0300.07719.17
5.4.420.0330.06719.34
5.4.410.0200.04719.51
5.4.400.0230.05719.14
5.4.390.0270.05019.09
5.4.380.0230.03319.08
5.4.370.0200.05719.21
5.4.360.0230.07018.99
5.4.350.0370.06719.24
5.4.340.0200.04719.14
5.4.320.0370.05318.99
5.4.310.0330.06319.21
5.4.300.0300.06719.19
5.4.290.0300.07018.94
5.4.280.0270.06019.18
5.4.270.0300.03019.09
5.4.260.0270.07719.25
5.4.250.0300.06719.00
5.4.240.0330.06319.24
5.4.230.0330.06019.31
5.4.220.0200.04019.31
5.4.210.0370.06319.00
5.4.200.0400.06019.13
5.4.190.0400.04319.21
5.4.180.0230.04318.98
5.4.170.0400.04319.15
5.4.160.0200.04319.13
5.4.150.0270.05319.23
5.4.140.0230.07016.51
5.4.130.0300.04316.39
5.4.120.0230.03716.51
5.4.110.0270.05016.59
5.4.100.0270.05316.30
5.4.90.0270.03716.61
5.4.80.0270.04316.54
5.4.70.0300.06716.59
5.4.60.0330.06716.49
5.4.50.0170.04316.53
5.4.40.0400.05716.48
5.4.30.0300.07016.26
5.4.20.0300.03716.16
5.4.10.0400.04316.47
5.4.00.0270.07315.97
5.3.290.0370.07014.82
5.3.280.0300.05714.84
5.3.270.0300.06714.82
5.3.260.0330.07014.82
5.3.250.0230.05014.82
5.3.240.0300.06714.82
5.3.230.0300.05714.82
5.3.220.0300.03714.82
5.3.210.0300.05314.82
5.3.200.0330.06714.82
5.3.190.0270.07014.82
5.3.180.0270.07314.82
5.3.170.0300.06714.82
5.3.160.0230.06714.82
5.3.150.0300.06314.82
5.3.140.0300.04014.82
5.3.130.0300.04014.82
5.3.120.0230.07714.82
5.3.110.0230.03714.82
5.3.100.0330.05314.82
5.3.90.0270.06314.82
5.3.80.0230.04014.82
5.3.70.0270.06714.82
5.3.60.0200.04014.82
5.3.50.0270.03314.82
5.3.40.0370.05714.82
5.3.30.0330.05014.82
5.3.20.0330.06314.82
5.3.10.0200.06714.82
5.3.00.0230.03314.82
5.2.170.0170.03314.82
5.2.160.0270.05014.82
5.2.150.0270.06014.82
5.2.140.0330.04714.82
5.2.130.0330.05314.82
5.2.120.0230.05314.82
5.2.110.0130.04714.82
5.2.100.0170.03014.82
5.2.90.0130.03014.82
5.2.80.0200.02714.82
5.2.70.0130.03014.82
5.2.60.0100.03314.82
5.2.50.0200.03014.82
5.2.40.0100.03014.82
5.2.30.0170.02314.82
5.2.20.0070.03014.82
5.2.10.0130.03014.82
5.2.00.0130.02714.82
5.1.60.0100.02714.82
5.1.50.0170.02014.82
5.1.40.0130.02314.82
5.1.30.0100.02714.82
5.1.20.0100.05014.82
5.1.10.0130.02714.82
5.1.00.0100.03014.82
5.0.50.0100.01714.82
5.0.40.0070.02014.82
5.0.30.0030.03314.82
5.0.20.0070.02014.82
5.0.10.0070.02014.82
5.0.00.0100.02714.82
4.4.90.0030.01714.82
4.4.80.0030.01714.82
4.4.70.0030.02014.82
4.4.60.0100.01714.82
4.4.50.0030.02314.82
4.4.40.0100.02314.82
4.4.30.0070.01714.82
4.4.20.0070.01714.82
4.4.10.0070.01714.82
4.4.00.0030.03014.82
4.3.110.0070.01314.82
4.3.100.0070.01314.82
4.3.90.0070.01314.82
4.3.80.0030.02714.82
4.3.70.0030.01714.82
4.3.60.0070.01714.82
4.3.50.0070.01714.82
4.3.40.0070.02314.82
4.3.30.0000.01714.82
4.3.20.0030.01314.82
4.3.10.0030.01314.82
4.3.00.0030.01714.82

preferences:
42.41 ms | 401 KiB | 5 Q