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($v());die; $value = $v(); // and a callback! $this->{$key} = $value; } } $test = new Test; // start editing here class A implements ArrayAccess { private $callCount = 0; public function __invoke($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.60.0060.01218.39
8.3.50.0230.00821.14
8.3.40.0140.00718.84
8.3.30.0040.01120.43
8.3.20.0000.00720.21
8.3.10.0080.00022.14
8.3.00.0040.00422.43
8.2.180.0120.00916.50
8.2.170.0070.01022.96
8.2.160.0070.00720.43
8.2.150.0040.00424.18
8.2.140.0030.00624.66
8.2.130.0000.00826.16
8.2.120.0030.00519.77
8.2.110.0060.00322.25
8.2.100.0040.00819.25
8.2.90.0080.00019.36
8.2.80.0000.00819.45
8.2.70.0050.00317.75
8.2.60.0030.00718.05
8.2.50.0030.00618.07
8.2.40.0040.00418.16
8.2.30.0000.00818.05
8.2.20.0040.00417.84
8.2.10.0070.00017.82
8.2.00.0040.00417.82
8.1.280.0140.00725.92
8.1.270.0040.00424.66
8.1.260.0000.00826.35
8.1.250.0080.00028.09
8.1.240.0090.00023.82
8.1.230.0000.01118.97
8.1.220.0040.00417.78
8.1.210.0050.00318.77
8.1.200.0030.00717.35
8.1.190.0050.00317.64
8.1.180.0070.00020.03
8.1.170.0000.00818.41
8.1.160.0000.00722.02
8.1.150.0040.00418.59
8.1.140.0040.00417.35
8.1.130.0070.00317.89
8.1.120.0080.00017.52
8.1.110.0080.00017.37
8.1.100.0000.00717.52
8.1.90.0000.00717.34
8.1.80.0040.00417.54
8.1.70.0070.00017.38
8.1.60.0030.00517.61
8.1.50.0050.00317.52
8.1.40.0000.00717.54
8.1.30.0030.00517.50
8.1.20.0040.00417.58
8.1.10.0000.00717.45
8.1.00.0040.00817.41
8.0.300.0000.00718.77
8.0.290.0040.00417.13
8.0.280.0070.00018.46
8.0.270.0030.00317.19
8.0.260.0030.00316.83
8.0.250.0040.00417.06
8.0.240.0100.00016.98
8.0.230.0030.00316.91
8.0.220.0000.00716.98
8.0.210.0050.00316.95
8.0.200.0000.00616.90
8.0.190.0040.00416.98
8.0.180.0050.00216.93
8.0.170.0040.00416.90
8.0.160.0070.00017.04
8.0.150.0040.00416.91
8.0.140.0000.00716.82
8.0.130.0060.00013.40
8.0.120.0000.01016.93
8.0.110.0000.00817.04
8.0.100.0030.00316.81
8.0.90.0040.00416.89
8.0.80.0090.00616.95
8.0.70.0080.00016.93
8.0.60.0040.00416.92
8.0.50.0040.00416.92
8.0.30.0130.01017.02
8.0.20.0130.00717.40
8.0.10.0040.00417.03
8.0.00.0060.01516.86
7.4.330.0060.00015.00
7.4.320.0030.00316.63
7.4.300.0040.00416.53
7.4.290.0050.00216.51
7.4.280.0000.00716.66
7.4.270.0040.00416.38
7.4.260.0040.00416.64
7.4.250.0000.00716.48
7.4.240.0020.00516.57
7.4.230.0000.00716.32
7.4.220.0030.01416.69
7.4.210.0030.01216.63
7.4.200.0070.00016.27
7.4.190.0030.00316.44
7.4.160.0060.01216.51
7.4.150.0130.00517.40
7.4.140.0100.01017.86
7.4.130.0100.00816.59
7.4.120.0120.00416.62
7.4.110.0080.01216.66
7.4.100.0070.01116.61
7.4.90.0120.00616.67
7.4.80.0090.00919.39
7.4.70.0040.01916.54
7.4.60.0120.00616.68
7.4.50.0050.00316.49
7.4.40.0000.01322.77
7.4.30.0070.01016.36
7.4.00.0040.01315.12
7.3.330.0000.00513.27
7.3.320.0060.00013.40
7.3.310.0000.00716.38
7.3.300.0000.00716.39
7.3.290.0070.00816.40
7.3.280.0090.00816.36
7.3.270.0120.00617.40
7.3.260.0110.00816.53
7.3.250.0090.01316.40
7.3.240.0060.01216.55
7.3.230.0130.00316.39
7.3.210.0090.00916.39
7.3.200.0160.00419.39
7.3.190.0110.01116.39
7.3.180.0120.00416.26
7.3.170.0130.00316.31
7.3.160.0070.01116.30
7.3.120.0020.01514.93
7.3.110.0050.01014.68
7.3.100.0020.01414.82
7.3.90.0050.00914.66
7.3.80.0080.00714.75
7.3.70.0030.00914.77
7.3.60.0030.01114.86
7.3.50.0050.00914.92
7.3.40.0050.01114.65
7.3.30.0060.00814.83
7.3.20.0080.00716.71
7.3.10.0080.00516.65
7.3.00.0080.00516.70
7.2.330.0000.01916.82
7.2.320.0070.01016.74
7.2.310.0060.01616.45
7.2.300.0120.00916.74
7.2.290.0100.00616.80
7.2.250.0100.01014.93
7.2.240.0070.01115.26
7.2.230.0090.00815.20
7.2.220.0060.00615.24
7.2.210.0070.00915.03
7.2.200.0020.01414.88
7.2.190.0030.01214.91
7.2.180.0090.00514.87
7.2.170.0070.01015.15
7.2.160.0090.00614.82
7.2.150.0000.01717.05
7.2.140.0090.00616.96
7.2.130.0030.01516.83
7.2.120.0030.01317.06
7.2.110.0030.01416.67
7.2.100.0090.00616.84
7.2.90.0070.00716.99
7.2.80.0140.00316.85
7.2.70.0030.01017.03
7.2.60.0020.01216.88
7.2.50.0030.01416.95
7.2.40.0150.00016.80
7.2.30.0100.00717.03
7.2.20.0060.00916.89
7.2.10.0030.01216.85
7.2.00.0020.01318.21
7.1.330.0060.00915.88
7.1.320.0040.01015.76
7.1.310.0110.00515.73
7.1.300.0060.00815.65
7.1.290.0000.01015.59
7.1.280.0080.00615.73
7.1.270.0120.00215.76
7.1.260.0020.01215.79
7.1.250.0000.01815.62
7.1.200.0000.01415.70
7.1.100.0040.00817.97
7.1.70.0030.00717.28
7.1.60.0100.01319.21
7.1.50.0040.01117.03
7.1.00.0030.03322.57
7.0.200.0230.00314.64
7.0.140.0100.06722.00
7.0.60.0130.06719.86
7.0.50.0100.04017.86
7.0.40.0070.04320.18
7.0.30.0230.06320.19
7.0.20.0300.08720.12
7.0.10.0470.07020.22
7.0.00.0000.04320.15
5.6.280.0000.07721.04
5.6.210.0070.04020.71
5.6.200.0100.05018.19
5.6.190.0100.08320.48
5.6.180.0300.07020.64
5.6.170.0200.03720.57
5.6.160.0070.04020.47
5.6.150.0070.03718.21
5.6.140.0070.08018.21
5.6.130.0000.05018.18
5.6.120.0130.07321.02
5.6.110.0070.08720.97
5.6.100.0000.09021.00
5.6.90.0030.04321.11
5.6.80.0070.03720.36
5.6.70.0330.05320.28
5.5.350.0030.07320.45
5.5.340.0130.04318.02
5.5.330.0030.08720.48
5.5.320.0270.07320.39
5.5.310.0230.03720.27
5.5.300.0030.08717.97
5.5.290.0070.04017.99
5.5.280.0100.03720.70
5.5.270.0030.09020.69
5.5.260.0130.08320.64
5.5.250.0100.08020.63
5.5.240.0070.04020.09
5.4.450.0170.08319.41
5.4.440.0300.07719.38
5.4.430.0230.06019.47
5.4.420.0270.04719.17
5.4.410.0200.04019.35
5.4.400.0270.07019.09
5.4.390.0200.04019.08
5.4.380.0230.05018.94
5.4.370.0200.05319.24
5.4.360.0230.07319.05
5.4.350.0230.08319.22
5.4.340.0200.05318.88
5.4.320.0300.04019.15
5.4.310.0230.05018.99
5.4.300.0200.03719.07
5.4.290.0230.03319.30
5.4.280.0170.04018.85
5.4.270.0270.03719.15
5.4.260.0200.03319.15
5.4.250.0270.03319.31
5.4.240.0200.03719.14
5.4.230.0130.04019.18
5.4.220.0070.04319.21
5.4.210.0130.04318.94
5.4.200.0170.03318.93
5.4.190.0170.03319.21
5.4.180.0100.04018.98
5.4.170.0130.03719.08
5.4.160.0170.04018.92
5.4.150.0130.04019.11
5.4.140.0100.04016.52
5.4.130.0100.04316.52
5.4.120.0100.03716.35
5.4.110.0170.03316.54
5.4.100.0130.03716.46
5.4.90.0130.03316.54
5.4.80.0230.06016.39
5.4.70.0170.06716.34
5.4.60.0330.03316.40
5.4.50.0170.05316.53
5.4.40.0300.04316.23
5.4.30.0200.07316.59
5.4.20.0300.06716.51
5.4.10.0230.03716.16
5.4.00.0230.07015.91
5.3.290.0130.04314.84
5.3.280.0100.04014.52
5.3.270.0300.03014.53
5.3.260.0070.04714.53
5.3.250.0100.04014.54
5.3.240.0270.03014.66
5.3.230.0170.04014.61
5.3.220.0170.03714.80
5.3.210.0200.07714.51
5.3.200.0130.03714.50
5.3.190.0230.04314.58
5.3.180.0230.03714.48
5.3.170.0270.05014.47
5.3.160.0270.05314.49
5.3.150.0200.04714.67
5.3.140.0200.03314.48
5.3.130.0370.03714.56
5.3.120.0200.04714.56
5.3.110.0170.06714.48
5.3.100.0230.07314.27
5.3.90.0170.06713.96
5.3.80.0270.05014.25
5.3.70.0270.06014.16
5.3.60.0230.07014.00
5.3.50.0230.04314.05
5.3.40.0230.07014.05
5.3.30.0200.04014.09
5.3.20.0200.07313.71
5.3.10.0230.07013.60
5.3.00.0230.07013.71
5.2.170.0200.05011.16
5.2.160.0270.05711.17
5.2.150.0170.04011.06
5.2.140.0300.05311.17
5.2.130.0230.03011.08
5.2.120.0170.04711.04
5.2.110.0200.05711.13
5.2.100.0270.04711.04
5.2.90.0170.05311.17
5.2.80.0170.04011.09
5.2.70.0130.04011.20
5.2.60.0130.03711.29
5.2.50.0230.06011.13
5.2.40.0170.04711.06
5.2.30.0170.05710.90
5.2.20.0130.05010.88
5.2.10.0200.05710.80
5.2.00.0200.04310.90
5.1.60.0170.04310.80
5.1.50.0230.03710.80
5.1.40.0230.02010.80
5.1.30.0130.05310.80
5.1.20.0170.03010.80
5.1.10.0270.04310.80
5.1.00.0270.03010.80
5.0.50.0070.02010.80
5.0.40.0130.04010.80
5.0.30.0070.06310.80
5.0.20.0070.04010.80
5.0.10.0100.04010.80
5.0.00.0070.04010.80
4.4.90.0070.03710.80
4.4.80.0100.01310.80
4.4.70.0100.02010.80
4.4.60.0070.03010.80
4.4.50.0130.01710.80
4.4.40.0100.04310.80
4.4.30.0100.02710.80
4.4.20.0100.02010.80
4.4.10.0000.02310.80
4.4.00.0100.04710.80
4.3.110.0070.03710.80
4.3.100.0130.03010.80
4.3.90.0100.03310.80
4.3.80.0100.05010.80
4.3.70.0070.03710.80
4.3.60.0170.02710.80
4.3.50.0100.03310.80
4.3.40.0070.05310.80
4.3.30.0070.02710.80
4.3.20.0070.02310.80
4.3.10.0030.03710.80
4.3.00.0030.02710.80

preferences:
52.59 ms | 400 KiB | 5 Q