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){ 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){ $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.60.0100.01018.68
8.3.50.0110.00621.09
8.3.40.0090.00619.01
8.3.30.0130.00320.34
8.3.20.0000.00720.34
8.3.10.0000.00822.13
8.3.00.0040.00422.36
8.2.180.0130.00918.25
8.2.170.0100.01022.96
8.2.160.0150.00020.34
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0000.00726.16
8.2.120.0030.00619.54
8.2.110.0060.00321.95
8.2.100.0040.00819.34
8.2.90.0040.00419.22
8.2.80.0000.00819.21
8.2.70.0030.00617.50
8.2.60.0030.00918.03
8.2.50.0040.00418.07
8.2.40.0080.00018.16
8.2.30.0040.00418.14
8.2.20.0040.00417.66
8.2.10.0000.00817.76
8.2.00.0060.00317.88
8.1.280.0040.01425.92
8.1.270.0040.00424.66
8.1.260.0000.00826.35
8.1.250.0080.00028.09
8.1.240.0080.00323.97
8.1.230.0040.00719.05
8.1.220.0000.00917.74
8.1.210.0060.00318.77
8.1.200.0030.00717.35
8.1.190.0030.00517.53
8.1.180.0060.00320.23
8.1.170.0030.00518.41
8.1.160.0040.00422.20
8.1.150.0040.00418.68
8.1.140.0040.00417.50
8.1.130.0030.00517.79
8.1.120.0040.00417.48
8.1.110.0000.00817.33
8.1.100.0040.00417.49
8.1.90.0040.00317.34
8.1.80.0050.00217.38
8.1.70.0030.00317.45
8.1.60.0030.00617.48
8.1.50.0090.00017.45
8.1.40.0000.00717.58
8.1.30.0030.00517.64
8.1.20.0040.00417.57
8.1.10.0080.00017.62
8.1.00.0070.00317.59
8.0.300.0040.00418.77
8.0.290.0050.00317.05
8.0.280.0000.00718.46
8.0.270.0000.00717.27
8.0.260.0000.00616.84
8.0.250.0000.00616.94
8.0.240.0060.00616.93
8.0.230.0000.00716.91
8.0.220.0030.00516.84
8.0.210.0030.00317.00
8.0.200.0030.00316.95
8.0.190.0040.00416.89
8.0.180.0040.00416.95
8.0.170.0070.00016.93
8.0.160.0000.00717.03
8.0.150.0070.00016.87
8.0.140.0030.00616.92
8.0.130.0000.00513.39
8.0.120.0000.00816.94
8.0.110.0040.00416.97
8.0.100.0040.00416.96
8.0.90.0050.00216.77
8.0.80.0040.01116.94
8.0.70.0020.00516.84
8.0.60.0000.00716.92
8.0.50.0020.00517.00
8.0.30.0120.01217.12
8.0.20.0100.01017.40
8.0.10.0000.00817.07
8.0.00.0120.00716.76
7.4.330.0030.00315.00
7.4.320.0070.00016.44
7.4.300.0000.00816.43
7.4.290.0000.00716.51
7.4.280.0000.00716.49
7.4.270.0000.00716.61
7.4.260.0040.00416.56
7.4.250.0000.00816.58
7.4.240.0050.00216.56
7.4.230.0040.00416.55
7.4.220.0140.00316.39
7.4.210.0100.00516.61
7.4.200.0040.00416.31
7.4.190.0030.00516.65
7.4.160.0060.00916.36
7.4.150.0060.01217.40
7.4.140.0110.00817.86
7.4.130.0030.01416.69
7.4.120.0050.01216.41
7.4.110.0100.00716.49
7.4.100.0120.00616.56
7.4.90.0030.01516.63
7.4.80.0170.01719.39
7.4.70.0100.01316.53
7.4.60.0160.00816.50
7.4.50.0060.00316.18
7.4.40.0110.00722.77
7.4.30.0110.00516.61
7.4.00.0040.01114.86
7.3.330.0050.00013.44
7.3.320.0050.00013.21
7.3.310.0040.00416.41
7.3.300.0000.00716.34
7.3.290.0000.01616.37
7.3.280.0110.01016.39
7.3.270.0070.01117.40
7.3.260.0160.00716.53
7.3.250.0140.00716.58
7.3.240.0100.00716.38
7.3.230.0060.01216.42
7.3.210.0140.00316.47
7.3.200.0120.00619.39
7.3.190.0120.01016.55
7.3.180.0130.00316.49
7.3.170.0100.00616.57
7.3.160.0090.00916.42
7.3.120.0060.01014.83
7.2.330.0150.00416.74
7.2.320.0080.01416.65
7.2.310.0160.00816.65
7.2.300.0080.00816.60
7.2.290.0060.01116.66
7.2.60.0110.00716.61
7.2.50.0090.00616.84
7.2.00.0090.00619.12
7.1.200.0040.00715.66
7.1.70.0000.00717.38
7.1.60.0090.01619.21
7.1.50.0170.00716.96
7.1.00.0000.03722.33
7.0.200.0000.01116.77
7.0.140.0030.07321.95
7.0.60.0130.08020.04
7.0.50.0030.04017.88
7.0.40.0100.07720.27
7.0.30.0270.05020.30
7.0.20.0230.03320.23
7.0.10.0330.08020.33
7.0.00.0000.05020.22
5.6.280.0030.07321.09
5.6.210.0030.04720.72
5.6.200.0030.04018.19
5.6.190.0070.09020.67
5.6.180.0370.02720.58
5.6.170.0170.05320.47
5.6.160.0070.06320.39
5.6.150.0000.05018.28
5.6.140.0130.06718.24
5.6.130.0030.08318.15
5.6.120.0000.06021.13
5.6.110.0100.03721.15
5.6.100.0000.08321.02
5.6.90.0170.07721.05
5.6.80.0000.07020.54
5.6.70.4300.04020.55
5.5.350.0430.06720.45
5.5.340.0000.04317.94
5.5.330.0030.08020.20
5.5.320.0130.07720.28
5.5.310.0300.07020.35
5.5.300.0100.05317.95
5.5.290.0070.05017.98
5.5.280.0030.07320.67
5.5.270.0030.08320.91
5.5.260.0100.08020.91
5.5.250.0200.07020.57
5.5.240.0070.04020.28
5.4.450.0470.05019.49
5.4.440.0730.04019.58
5.4.430.0170.04019.54
5.4.420.0030.06319.39
5.4.410.0200.04719.44
5.4.400.0100.05319.26
5.4.390.0130.05019.02
5.4.380.0100.05319.12
5.4.370.0100.05319.23
5.4.360.0130.04719.07
5.4.350.0080.04412.03
5.4.340.0090.04812.03
5.4.320.0060.03612.52
5.4.310.0070.03612.52
5.4.300.0050.03812.52
5.4.290.0030.04212.51
5.4.280.0060.03512.41
5.4.270.0090.03812.41
5.4.260.0070.04212.41
5.4.250.0030.06018.88
5.4.240.0100.05018.97
5.4.230.0170.06718.73
5.4.220.0130.05018.97
5.4.210.0100.05018.74
5.4.200.0070.05018.94
5.4.190.0000.06718.98
5.4.180.0070.05018.64
5.4.170.0100.05319.02
5.4.160.0130.05318.91
5.4.150.0130.06018.88
5.4.140.0100.05716.45
5.4.130.0130.05016.43
5.4.120.0070.06716.44
5.4.110.0000.06316.45
5.4.100.0070.06316.53
5.4.90.0000.06016.55
5.4.80.0030.05716.51
5.4.70.0070.05716.49
5.4.60.0130.05016.35
5.4.50.0230.04316.37
5.4.40.0030.05716.59
5.4.30.0100.05316.46
5.4.20.0070.04716.46
5.4.10.0000.05716.33
5.4.00.0000.05015.95
5.3.290.0030.04212.80
5.3.280.0100.06314.68
5.3.270.0070.05014.69
5.3.260.0070.05314.59
5.3.250.0070.05314.79
5.3.240.0000.08014.79
5.3.230.0130.07014.70
5.3.220.0100.04714.44
5.3.210.0070.07714.66
5.3.200.0030.06714.76
5.3.190.0070.05014.66
5.3.180.0030.07314.55
5.3.170.0070.05014.59
5.3.160.0100.06314.73
5.3.150.0030.06014.41
5.3.140.0100.04314.75
5.3.130.0100.04714.65
5.3.120.0100.05314.39
5.3.110.0070.05314.55
5.3.100.0030.04713.87
5.3.90.0070.05013.88
5.3.80.0000.05014.03
5.3.70.0030.05014.12
5.3.60.0000.05314.00
5.3.50.0070.04313.98
5.3.40.0030.05014.05
5.3.30.0030.06314.07
5.3.20.0030.05013.79
5.3.10.0100.04313.73
5.3.00.0000.05313.50
5.2.170.0030.04711.17
5.2.160.0070.04011.28
5.2.150.0030.05711.12
5.2.140.0070.03711.13
5.2.130.0030.04311.19
5.2.120.0070.05311.18
5.2.110.0000.05311.18
5.2.100.0000.06311.27
5.2.90.0070.03711.25
5.2.80.0030.03710.95
5.2.70.0100.03311.18
5.2.60.0000.04710.91
5.2.50.0030.03710.86
5.2.40.0070.03710.99
5.2.30.0000.04710.80
5.2.20.0070.04310.93
5.2.10.0100.03010.86
5.2.00.0070.03710.75
5.1.60.0000.05010.24
5.1.50.0070.03010.24
5.1.40.0100.03310.24
5.1.30.0070.03310.35
5.1.20.0030.03710.43
5.1.10.0070.03310.24
5.1.00.0030.04010.24
5.0.50.0070.04010.24
5.0.40.0030.02710.24
5.0.30.0100.04010.24
5.0.20.0030.02310.24
5.0.10.0000.03010.24
5.0.00.0030.04010.24
4.4.90.0070.02710.24
4.4.80.0030.01710.24
4.4.70.0070.02310.24
4.4.60.0030.02310.24
4.4.50.0030.02310.24
4.4.40.0000.03310.24
4.4.30.0030.02710.24
4.4.20.0030.03010.24
4.4.10.0000.02310.24
4.4.00.0030.03010.24
4.3.110.0070.02010.24
4.3.100.0030.01710.24
4.3.90.0000.02010.24
4.3.80.0000.03710.24
4.3.70.0000.02310.24
4.3.60.0000.02010.24
4.3.50.0030.02010.24
4.3.40.0000.03710.24
4.3.30.0030.02310.24
4.3.20.0000.02710.24
4.3.10.0000.03010.24
4.3.00.0070.01314.48

preferences:
46.44 ms | 401 KiB | 5 Q