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! var_dump($value);die; $this->{$key} = $value; } } $test = new Test; // start editing here class A implements ArrayAccess { private $callCount = 0; public function __call($name, $args){ echo "WOOO";die; } 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){ $r = $this; } else { $r = "FOO"; } return $r; } } $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.40.0090.00618.78
8.3.30.0090.00620.18
8.3.20.0070.00020.52
8.3.10.0080.00022.15
8.3.00.0080.00022.34
8.2.170.0070.00722.96
8.2.160.0030.01620.35
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0070.00026.16
8.2.120.0040.00419.77
8.2.110.0100.00622.29
8.2.100.0070.00419.39
8.2.90.0060.00319.36
8.2.80.0000.00819.42
8.2.70.0000.01117.38
8.2.60.0100.00017.93
8.2.50.0000.00918.07
8.2.40.0040.00418.16
8.2.30.0000.00718.25
8.2.20.0000.00717.79
8.2.10.0030.00517.80
8.2.00.0000.00717.74
8.1.270.0080.00024.66
8.1.260.0050.00226.35
8.1.250.0000.00728.09
8.1.240.0060.00323.75
8.1.230.0040.00819.16
8.1.220.0040.00417.78
8.1.210.0090.00018.77
8.1.200.0060.00317.35
8.1.190.0000.00817.53
8.1.180.0000.00920.10
8.1.170.0000.00918.41
8.1.160.0040.00322.15
8.1.150.0040.00418.72
8.1.140.0050.00217.53
8.1.130.0050.00517.92
8.1.120.0000.00717.44
8.1.110.0040.00417.51
8.1.100.0000.00817.39
8.1.90.0030.00517.53
8.1.80.0000.00717.36
8.1.70.0030.00317.48
8.1.60.0060.00317.61
8.1.50.0030.00517.59
8.1.40.0030.00517.44
8.1.30.0020.00517.70
8.1.20.0080.00017.69
8.1.10.0040.00417.66
8.1.00.0050.00517.42
8.0.300.0000.00818.77
8.0.290.0000.00717.18
8.0.280.0040.00418.39
8.0.270.0050.00317.20
8.0.260.0030.00316.80
8.0.250.0000.00716.93
8.0.240.0080.00417.02
8.0.230.0040.00417.07
8.0.220.0040.00416.84
8.0.210.0020.00516.93
8.0.200.0000.00716.95
8.0.190.0040.00416.94
8.0.180.0040.00416.82
8.0.170.0050.00317.04
8.0.160.0000.00716.99
8.0.150.0070.00016.87
8.0.140.0040.00416.91
8.0.130.0000.00513.43
8.0.120.0050.00516.84
8.0.110.0000.00716.96
8.0.100.0000.00716.83
8.0.90.0030.00316.93
8.0.80.0090.00616.93
8.0.70.0000.00816.92
8.0.60.0000.00716.93
8.0.50.0000.00716.86
8.0.30.0110.01217.09
8.0.20.0130.00517.40
8.0.10.0030.00617.11
8.0.00.0120.00716.80
7.4.330.0000.00615.00
7.4.320.0030.00316.46
7.4.300.0030.00316.50
7.4.290.0070.00016.50
7.4.280.0070.00016.61
7.4.270.0000.00716.42
7.4.260.0030.00316.40
7.4.250.0060.00316.50
7.4.240.0050.00316.46
7.4.230.0000.00716.61
7.4.220.0150.00616.64
7.4.210.0050.01116.60
7.4.200.0000.00716.63
7.4.190.0070.00016.46
7.4.160.0110.00716.51
7.4.150.0100.00717.40
7.4.140.0090.00817.86
7.4.130.0100.00716.55
7.4.120.0160.00216.50
7.4.110.0030.01516.36
7.4.100.0090.01616.62
7.4.90.0040.01316.51
7.4.80.0130.00319.39
7.4.70.0070.01116.71
7.4.60.0060.00916.57
7.4.50.0060.00316.63
7.4.40.0030.01322.77
7.4.30.0060.01516.47
7.4.00.0100.00714.91
7.3.330.0000.00613.31
7.3.320.0030.00313.45
7.3.310.0000.00716.36
7.3.300.0000.00716.43
7.3.290.0100.00616.32
7.3.280.0090.00916.36
7.3.270.0140.00717.40
7.3.260.0130.00416.38
7.3.250.0080.01316.45
7.3.240.0130.01016.30
7.3.230.0140.00716.54
7.3.210.0100.00716.38
7.3.200.0100.00719.39
7.3.190.0120.00916.48
7.3.180.0130.00316.50
7.3.170.0130.00316.51
7.3.160.0090.01216.60
7.3.120.0110.00314.95
7.3.10.0140.01416.11
7.3.00.0160.00516.09
7.2.330.0060.01316.74
7.2.320.0100.01016.76
7.2.310.0140.00716.74
7.2.300.0060.01016.73
7.2.290.0060.00916.66
7.2.130.0150.00816.21
7.2.120.0210.00417.00
7.2.110.0110.01116.57
7.2.100.0140.00816.62
7.2.90.0090.00616.40
7.2.80.0230.00616.89
7.2.70.0110.00816.53
7.2.60.0040.00816.68
7.2.50.0120.00916.03
7.2.40.0150.01116.23
7.2.30.0130.00715.91
7.2.20.0160.00616.37
7.2.10.0040.01116.30
7.2.00.0140.01416.93
7.1.250.0100.00714.93
7.1.200.0000.00715.95
7.1.70.0040.00416.92
7.1.60.0070.01719.21
7.1.50.0130.00717.09
7.1.00.0000.03722.41
7.0.200.0000.01116.48
7.0.140.0070.07322.09
7.0.60.0130.04321.81
7.0.50.0030.04017.88
7.0.40.0100.07320.11
7.0.30.0470.07720.13
7.0.20.0270.07720.23
7.0.10.0000.04720.30
7.0.00.0070.05720.15
5.6.280.0000.07720.82
5.6.210.0100.07320.73
5.6.200.0100.08018.25
5.6.190.0000.09320.50
5.6.180.0200.04720.57
5.6.170.0130.05320.44
5.6.160.0100.09020.39
5.6.150.0170.06718.17
5.6.140.0030.05018.14
5.6.130.0030.08318.19
5.6.120.0170.07320.99
5.6.110.0070.04320.98
5.6.100.0070.04021.11
5.6.90.0130.07321.01
5.6.80.0030.06320.45
5.5.350.4230.04020.38
5.5.340.0100.06718.07
5.5.330.0100.08320.37
5.5.320.0170.04020.27
5.5.310.0270.07020.24
5.5.300.0030.04318.04
5.5.290.0000.04317.98
5.5.280.0030.07020.82
5.5.270.0070.08020.73
5.5.260.0100.08320.88
5.5.250.0170.06320.70
5.5.240.0270.07020.05
5.4.450.0130.05719.34
5.4.440.0900.05719.13
5.4.430.0130.05319.55
5.4.420.1030.06719.38
5.4.410.0630.06319.30
5.4.400.0370.04718.54
5.4.390.0400.07018.63
5.4.380.0200.05318.73
5.4.370.0270.06318.73
5.4.360.0230.04018.52
5.4.350.0050.04512.03
5.4.340.0050.04412.03
5.4.320.0070.04712.51
5.4.310.0020.04512.51
5.4.300.0040.03712.51
5.4.290.0080.03912.50
5.4.280.0050.03612.41
5.4.270.0070.03412.41
5.4.260.0060.03912.41
5.4.250.0030.07718.92
5.4.240.0030.07718.58
5.4.230.0030.06318.95
5.4.220.0000.07718.91
5.4.210.0070.06318.76
5.4.200.0100.05718.63
5.4.190.0030.05318.92
5.4.180.0030.05718.89
5.4.170.0070.06718.93
5.4.160.0000.07718.96
5.4.150.0100.05318.89
5.4.140.0100.04316.37
5.4.130.0070.05716.43
5.4.120.0000.06716.30
5.4.110.0070.06316.39
5.4.100.0030.05016.59
5.4.90.0030.05016.48
5.4.80.0100.05716.57
5.4.70.0070.06016.34
5.4.60.0030.05716.43
5.4.50.0100.04316.36
5.4.40.0030.06316.52
5.4.30.0100.05016.42
5.4.20.0070.07016.32
5.4.10.0070.05316.39
5.4.00.0070.06015.84
5.3.290.0030.04112.80
5.3.280.0030.05314.70
5.3.270.0000.06314.80
5.3.260.0130.06714.45
5.3.250.0070.05014.60
5.3.240.0100.05014.70
5.3.230.0130.05714.58
5.3.220.0070.06714.65
5.3.210.0130.06314.57
5.3.200.0130.04714.44
5.3.190.0100.06014.66
5.3.180.0070.04714.43
5.3.170.0100.04714.66
5.3.160.0100.06714.66
5.3.150.0030.06314.57
5.3.140.0070.05014.74
5.3.130.0070.06714.53
5.3.120.0070.05014.67
5.3.110.0100.04714.54
5.3.100.0100.06014.11
5.3.90.0070.04714.11
5.3.80.0100.06314.10
5.3.70.0070.06314.01
5.3.60.0030.05314.08
5.3.50.0030.05313.95
5.3.40.0030.05014.14
5.3.30.0030.04714.07
5.3.20.0030.05313.79
5.3.10.0100.04013.63
5.3.00.0130.04013.73
5.2.170.0070.04011.14
5.2.160.0100.04311.24
5.2.150.0000.04311.33
5.2.140.0030.06011.13
5.2.130.0030.04011.27
5.2.120.0070.04311.09
5.2.110.0030.04011.29
5.2.100.0130.04711.20
5.2.90.0070.04711.20
5.2.80.0000.05711.13
5.2.70.0030.04010.93
5.2.60.0070.05011.05
5.2.50.0030.05311.05
5.2.40.0130.04310.84
5.2.30.0000.06010.98
5.2.20.0130.03011.05
5.2.10.0030.04010.70
5.2.00.0030.04010.89
5.1.60.0030.03310.24
5.1.50.0130.03710.24
5.1.40.0070.04310.24
5.1.30.0030.04310.32
5.1.20.0030.04710.34
5.1.10.0030.03710.24
5.1.00.0030.03710.24
5.0.50.0030.03010.24
5.0.40.0070.03010.24
5.0.30.0000.06010.24
5.0.20.0030.03710.24
5.0.10.0000.03710.24
5.0.00.0000.04710.24
4.4.90.0030.02010.24
4.4.80.0000.03010.24
4.4.70.0000.03310.24
4.4.60.0070.02310.24
4.4.50.0000.02310.24
4.4.40.0000.03710.24
4.4.30.0030.02010.24
4.4.20.0000.02010.24
4.4.10.0030.02010.24
4.4.00.0000.04710.24
4.3.110.0000.03010.24
4.3.100.0000.03010.24
4.3.90.0000.02310.24
4.3.80.0070.02710.24
4.3.70.0030.03010.24
4.3.60.0000.03310.24
4.3.50.0000.03010.24
4.3.40.0000.04710.24
4.3.30.0030.02010.24
4.3.20.0000.02710.24
4.3.10.0000.02710.24
4.3.00.0000.0235.92

preferences:
43.4 ms | 400 KiB | 5 Q