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 var_dump($key);die; $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){ $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.0090.01218.68
8.3.50.0140.00521.14
8.3.40.0120.00318.92
8.3.30.0120.00320.18
8.3.20.0060.00319.91
8.3.10.0040.00422.05
8.3.00.0040.00422.30
8.2.180.0090.00618.41
8.2.170.0110.00422.96
8.2.160.0080.00520.33
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0030.00519.35
8.2.110.0040.00422.20
8.2.100.0060.00619.41
8.2.90.0050.00319.34
8.2.80.0000.00819.24
8.2.70.0070.00317.75
8.2.60.0030.00618.05
8.2.50.0000.00818.07
8.2.40.0000.00718.16
8.2.30.0040.00418.03
8.2.20.0030.00617.86
8.2.10.0050.00317.87
8.2.00.0000.00717.84
8.1.280.0090.00625.92
8.1.270.0040.00424.66
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00618.73
8.1.230.0000.01219.14
8.1.220.0000.00817.78
8.1.210.0040.00718.77
8.1.200.0090.00017.23
8.1.190.0000.00817.54
8.1.180.0080.00020.30
8.1.170.0040.00418.65
8.1.160.0040.00422.16
8.1.150.0070.00018.54
8.1.140.0000.00717.41
8.1.130.0050.00517.75
8.1.120.0000.00717.54
8.1.110.0000.00817.48
8.1.100.0040.00417.32
8.1.90.0050.00317.46
8.1.80.0040.00417.46
8.1.70.0000.00717.47
8.1.60.0060.00317.61
8.1.50.0040.00417.47
8.1.40.0080.00017.44
8.1.30.0000.00817.61
8.1.20.0000.00817.73
8.1.10.0030.00517.49
8.1.00.0030.00617.53
8.0.300.0040.00418.77
8.0.290.0040.00417.05
8.0.280.0040.00418.50
8.0.270.0000.00717.28
8.0.260.0000.00716.90
8.0.250.0040.00416.94
8.0.240.0030.00717.03
8.0.230.0070.00017.07
8.0.220.0020.00517.01
8.0.210.0030.00316.95
8.0.200.0030.00316.92
8.0.190.0000.00816.91
8.0.180.0070.00317.03
8.0.170.0040.00416.88
8.0.160.0000.00816.89
8.0.150.0040.00416.78
8.0.140.0070.00016.82
8.0.130.0000.00613.28
8.0.120.0040.00416.99
8.0.110.0070.00016.96
8.0.100.0040.00317.04
8.0.90.0040.00416.88
8.0.80.0100.00716.95
8.0.70.0000.00817.01
8.0.60.0070.00016.86
8.0.50.0040.00417.01
8.0.30.0070.01217.29
8.0.20.0130.00717.40
8.0.10.0080.00017.15
8.0.00.0090.01416.87
7.4.330.0000.00515.00
7.4.320.0040.00416.66
7.4.300.0040.00416.50
7.4.290.0030.00316.47
7.4.280.0000.00616.46
7.4.270.0030.00316.43
7.4.260.0050.00216.40
7.4.250.0050.00216.34
7.4.240.0050.00216.62
7.4.230.0030.00316.43
7.4.220.0060.01016.60
7.4.210.0050.01116.55
7.4.200.0070.00016.64
7.4.190.0000.00716.59
7.4.160.0160.00516.48
7.4.150.0110.00817.40
7.4.140.0120.00617.86
7.4.130.0100.00616.68
7.4.120.0130.00716.62
7.4.110.0080.00816.70
7.4.100.0090.00916.47
7.4.90.0030.01416.33
7.4.80.0080.00919.39
7.4.70.0060.01216.59
7.4.60.0110.00616.54
7.4.50.0000.00616.57
7.4.40.0030.01222.77
7.4.30.0070.01016.43
7.4.00.0090.00614.83
7.3.330.0030.00313.42
7.3.320.0000.00513.25
7.3.310.0000.00716.44
7.3.300.0030.00316.26
7.3.290.0040.01116.41
7.3.280.0070.00816.40
7.3.270.0080.00817.40
7.3.260.0060.01216.34
7.3.250.0140.00716.46
7.3.240.0120.00616.43
7.3.230.0070.01016.39
7.3.210.0000.01616.38
7.3.200.0120.00619.39
7.3.190.0140.00716.55
7.3.180.0040.01416.36
7.3.170.0030.01316.63
7.3.160.0160.00316.49
7.3.120.0050.00514.68
7.3.10.0070.01016.34
7.3.00.0040.01116.57
7.2.330.0100.01416.81
7.2.320.0000.01816.49
7.2.310.0030.01916.49
7.2.300.0110.00616.53
7.2.290.0120.00316.79
7.2.130.0060.00616.94
7.2.120.0120.00316.89
7.2.110.0000.01416.95
7.2.100.0000.00916.93
7.2.90.0040.01117.06
7.2.80.0090.00616.97
7.2.70.0030.00816.84
7.2.60.0000.01316.95
7.2.50.0040.00817.09
7.2.40.0080.00817.05
7.2.30.0040.01117.06
7.2.20.0070.00417.13
7.2.10.0100.00717.02
7.2.00.0070.00717.02
7.1.250.0000.01015.97
7.1.70.0130.00717.09
7.1.60.0100.01619.21
7.1.50.0070.01416.70
7.1.00.0000.05322.36
7.0.200.0440.00014.62
7.0.140.0170.06321.96
7.0.60.0000.08319.95
7.0.50.0030.04717.89
7.0.40.0000.04720.13
7.0.30.0370.06320.16
7.0.20.0430.07320.17
7.0.10.0030.05020.30
7.0.00.0070.09020.23
5.6.280.0030.07320.83
5.6.210.0100.08020.56
5.6.200.0100.06718.18
5.6.190.0070.05020.60
5.6.180.0200.04720.39
5.6.170.0200.08320.51
5.6.160.0030.05720.39
5.6.150.0030.04018.16
5.6.140.0100.03318.18
5.6.130.0100.03318.13
5.6.120.0030.06720.98
5.6.110.0070.04321.04
5.6.100.0100.07721.12
5.6.90.0100.06721.03
5.6.80.0070.08720.36
5.5.350.3830.04320.45
5.5.340.0000.05717.97
5.5.330.0030.07020.47
5.5.320.0000.06720.38
5.5.310.0300.07320.27
5.5.300.0130.07718.08
5.5.290.0070.08318.08
5.5.280.0100.08020.88
5.5.270.0100.08320.89
5.5.260.0030.06720.89
5.5.250.0070.04320.79
5.5.240.0300.06320.29
5.4.450.0070.07719.28
5.4.440.0000.06319.41
5.4.430.0070.07719.46
5.4.420.0070.06019.27
5.4.410.0070.05719.14
5.4.400.0030.04319.00
5.4.390.0030.04019.06
5.4.380.0030.04019.08
5.4.370.0030.07019.00
5.4.360.0030.07719.09
5.4.350.0000.04319.15
5.4.340.0030.07719.24
5.4.320.0030.04319.09
5.4.310.0100.05719.06
5.4.300.0130.06018.87
5.4.290.0030.07319.15
5.4.280.0030.05019.17
5.4.270.0030.08019.17
5.4.260.0030.07318.85
5.4.250.0000.04318.99
5.4.240.0070.05719.08
5.4.230.0070.03318.86
5.4.220.0030.04019.19
5.4.210.0070.03319.08
5.4.200.0000.07318.86
5.4.190.0070.04718.86
5.4.180.0030.04019.16
5.4.170.0030.07719.16
5.4.160.0030.04719.19
5.4.150.0000.04019.18
5.4.140.0030.03316.39
5.4.130.0070.03316.42
5.4.120.0030.03316.38
5.4.110.0070.03716.50
5.4.100.0000.05316.50
5.4.90.0070.05016.59
5.4.80.0000.05716.60
5.4.70.0030.07016.60
5.4.60.0070.03716.51
5.4.50.0070.03016.51
5.4.40.0030.04016.51
5.4.30.0070.05016.32
5.4.20.0030.04016.44
5.4.10.0000.04016.43
5.4.00.0070.04315.80
5.3.290.0000.04314.69
5.3.280.0000.08014.64
5.3.270.0030.07314.60
5.3.260.0000.05314.63
5.3.250.0030.07014.61
5.3.240.0000.06714.71
5.3.230.0130.06714.48
5.3.220.0030.07714.49
5.3.210.0070.07014.73
5.3.200.0000.04014.80
5.3.190.0030.07714.66
5.3.180.0000.04314.65
5.3.170.0030.03314.59
5.3.160.0030.04014.80
5.3.150.0000.04314.48
5.3.140.0070.06314.57
5.3.130.0000.04714.46
5.3.120.0000.04314.71
5.3.110.0030.03714.64
5.3.100.0030.03314.10
5.3.90.0100.06714.15
5.3.80.0000.07713.94
5.3.70.0000.03713.95
5.3.60.0030.03713.93
5.3.50.0070.03013.95
5.3.40.0070.03713.88
5.3.30.0030.03313.86
5.3.20.0000.03713.86
5.3.10.0030.03013.86
5.3.00.0100.02713.86
5.2.170.0030.02713.86
5.2.160.0070.03313.86
5.2.150.0130.02313.86
5.2.140.0000.03013.86
5.2.130.0030.04313.86
5.2.120.0070.02313.86
5.2.110.0030.02313.86
5.2.100.0000.03013.86
5.2.90.0030.05713.86
5.2.80.0030.05713.86
5.2.70.0030.03313.86
5.2.60.0000.06313.86
5.2.50.0030.04313.86
5.2.40.0030.06013.86
5.2.30.0000.03013.86
5.2.20.0030.02713.86
5.2.10.0000.02713.86
5.2.00.0000.06013.86
5.1.60.0000.02713.86
5.1.50.0030.02713.86
5.1.40.0000.02313.86
5.1.30.0000.05713.86
5.1.20.0030.03713.86
5.1.10.0000.03013.86
5.1.00.0030.02313.86
5.0.50.0000.02013.86
5.0.40.0030.04313.86
5.0.30.0030.05313.86
5.0.20.0000.03713.86
5.0.10.0070.04013.86
5.0.00.0000.04313.86
4.4.90.0000.03713.86
4.4.80.0030.02313.86
4.4.70.0100.03013.86
4.4.60.0000.02713.86
4.4.50.0000.03713.86
4.4.40.0030.05013.86
4.4.30.0030.01713.86
4.4.20.0070.03013.86
4.4.10.0030.02713.86
4.4.00.0070.03313.86
4.3.110.0000.02313.86
4.3.100.0000.02013.86
4.3.90.0070.03313.86
4.3.80.0100.05013.86
4.3.70.0030.03713.86
4.3.60.0030.02013.86
4.3.50.0030.02313.86
4.3.40.0000.02713.86
4.3.30.0030.01313.86
4.3.20.0000.01713.86
4.3.10.0000.02013.86
4.3.00.0030.01313.86

preferences:
66.49 ms | 401 KiB | 5 Q