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 { private $callCount = 0; public function __invoke(){ var_dump($this);die; echo "WOO";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.0120.00618.68
8.3.50.0060.01021.14
8.3.40.0070.00718.82
8.3.30.0070.00720.16
8.3.20.0050.00320.23
8.3.10.0040.00422.14
8.3.00.0000.00822.44
8.2.180.0150.00718.54
8.2.170.0130.00619.08
8.2.160.0070.00722.96
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0040.00419.54
8.2.110.0060.00322.30
8.2.100.0000.01119.38
8.2.90.0030.00519.05
8.2.80.0080.00019.21
8.2.70.0060.00317.63
8.2.60.0080.00017.93
8.2.50.0040.00418.07
8.2.40.0030.00518.16
8.2.30.0000.00818.07
8.2.20.0040.00417.74
8.2.10.0030.00517.84
8.2.00.0030.00617.75
8.1.280.0090.00625.92
8.1.270.0090.00924.66
8.1.260.0070.00026.35
8.1.250.0070.00028.09
8.1.240.0040.00423.68
8.1.230.0060.00619.21
8.1.220.0040.00417.76
8.1.210.0000.00818.77
8.1.200.0040.00417.23
8.1.190.0040.00417.53
8.1.180.0040.00420.02
8.1.170.0030.00518.44
8.1.160.0070.00022.15
8.1.150.0000.00718.67
8.1.140.0040.00417.52
8.1.130.0000.00917.84
8.1.120.0000.00817.54
8.1.110.0080.00017.51
8.1.100.0080.00017.54
8.1.90.0070.00017.43
8.1.80.0040.00417.47
8.1.70.0030.00317.36
8.1.60.0030.00617.54
8.1.50.0000.00817.45
8.1.40.0030.00617.44
8.1.30.0070.00017.60
8.1.20.0000.00817.71
8.1.10.0000.00817.53
8.1.00.0040.00417.44
8.0.300.0040.00418.77
8.0.290.0040.00417.05
8.0.280.0050.00318.53
8.0.270.0030.00317.33
8.0.260.0000.00716.82
8.0.250.0040.00416.94
8.0.240.0030.00717.08
8.0.230.0030.00317.02
8.0.220.0040.00417.05
8.0.210.0000.00717.05
8.0.200.0030.00317.00
8.0.190.0000.00817.05
8.0.180.0040.00416.93
8.0.170.0050.00316.96
8.0.160.0000.00717.07
8.0.150.0040.00416.89
8.0.140.0030.00516.90
8.0.130.0030.00313.37
8.0.120.0070.00016.84
8.0.110.0040.00416.97
8.0.100.0070.00017.01
8.0.90.0040.00417.04
8.0.80.0090.00817.01
8.0.70.0050.00317.01
8.0.60.0000.00716.85
8.0.50.0050.00217.02
8.0.30.0110.00817.29
8.0.20.0060.01117.40
8.0.10.0000.00716.96
8.0.00.0130.00616.75
7.4.330.0020.00215.00
7.4.320.0030.00316.63
7.4.300.0030.00316.65
7.4.290.0030.00316.42
7.4.280.0050.00316.56
7.4.270.0070.00016.44
7.4.260.0030.00316.41
7.4.250.0040.00416.50
7.4.240.0020.00516.53
7.4.230.0000.00716.59
7.4.220.0080.00816.60
7.4.210.0090.00616.52
7.4.200.0070.00016.32
7.4.190.0000.00716.57
7.4.160.0120.00416.54
7.4.150.0080.01117.40
7.4.140.0110.01217.86
7.4.130.0100.00716.58
7.4.120.0050.01116.56
7.4.110.0130.00316.64
7.4.100.0070.01016.61
7.4.90.0120.00916.55
7.4.80.0140.01219.39
7.4.70.0100.00816.60
7.4.60.0090.01116.45
7.4.50.0000.00616.52
7.4.40.0080.00622.77
7.4.30.0100.01316.66
7.4.00.0070.00714.84
7.3.330.0030.00313.43
7.3.320.0030.00313.19
7.3.310.0000.00716.38
7.3.300.0000.00716.35
7.3.290.0070.00716.35
7.3.280.0070.01116.36
7.3.270.0130.00517.40
7.3.260.0140.00316.67
7.3.250.0130.01216.59
7.3.240.0030.01316.32
7.3.230.0090.01316.40
7.3.210.0090.00916.37
7.3.200.0100.01019.39
7.3.190.0120.00616.55
7.3.180.0060.01116.37
7.3.170.0110.00616.46
7.3.160.0130.00316.56
7.3.120.0070.00714.78
7.2.330.0140.00316.57
7.2.320.0050.01116.48
7.2.310.0090.01216.66
7.2.300.0140.00316.50
7.2.290.0030.01416.68
7.2.60.0030.01416.91
7.2.00.0130.00319.28
7.1.200.0030.00315.65
7.1.100.0070.01118.09
7.1.70.0060.00917.25
7.1.60.0060.01819.21
7.1.50.0070.00416.86
7.1.00.0070.03022.29
7.0.200.0020.00516.65
7.0.140.0030.07722.09
7.0.60.0030.04320.09
7.0.50.0170.06717.73
7.0.40.0100.04720.09
7.0.30.0400.08020.21
7.0.20.0170.04720.19
7.0.10.0170.08020.20
7.0.00.0070.08720.10
5.6.280.0070.07021.10
5.6.210.0070.06320.68
5.6.200.0070.08018.18
5.6.190.0200.08020.46
5.6.180.0430.04020.39
5.6.170.0370.07320.62
5.6.160.0000.08320.52
5.6.150.0070.04718.19
5.6.140.0070.08318.28
5.6.130.0030.06718.11
5.6.120.0100.07321.03
5.6.110.0030.05021.05
5.6.100.0100.07020.96
5.6.90.0070.04721.12
5.6.80.0100.07320.40
5.5.350.0170.05320.34
5.5.340.0070.05017.98
5.5.330.0130.07320.40
5.5.320.0300.07320.24
5.5.310.0400.07320.41
5.5.300.0030.07017.93
5.5.290.0030.04017.99
5.5.280.0100.04720.75
5.5.270.0070.04320.86
5.5.260.0100.07720.74
5.5.250.0070.07020.69
5.5.240.0100.04720.24
5.4.450.0930.05719.57
5.4.440.0030.06719.61
5.4.430.0100.06019.22
5.4.420.0170.07019.51
5.4.410.0130.05019.00
5.4.400.0030.06318.77
5.4.390.0270.03718.74
5.4.380.0100.05718.63
5.4.370.0170.05018.56
5.4.360.0130.05318.80
5.4.350.0070.03612.03
5.4.340.0070.03612.03
5.4.320.0060.03612.51
5.4.310.0080.04212.50
5.4.300.0090.04012.51
5.4.290.0050.03912.51
5.4.280.0050.04812.40
5.4.270.0080.03412.41
5.4.260.0050.03912.40
5.4.250.0070.05318.96
5.4.240.0130.05718.89
5.4.230.0100.04318.94
5.4.220.0000.06018.69
5.4.210.0030.05018.98
5.4.200.0070.05018.97
5.4.190.0030.05318.68
5.4.180.0000.08318.77
5.4.170.0000.05718.74
5.4.160.0030.07718.93
5.4.150.0000.06018.72
5.4.140.0100.04716.50
5.4.130.0100.05316.48
5.4.120.0130.04316.38
5.4.110.0030.06316.55
5.4.100.0030.05016.52
5.4.90.0070.06716.43
5.4.80.0030.05316.47
5.4.70.0100.06016.55
5.4.60.0130.05716.56
5.4.50.0000.06316.30
5.4.40.0030.06316.41
5.4.30.0100.05316.35
5.4.20.0170.05716.34
5.4.10.0070.06016.38
5.4.00.0070.05715.75
5.3.290.0030.04212.80
5.3.280.0000.05014.67
5.3.270.0100.06314.60
5.3.260.0100.05714.79
5.3.250.0100.06714.70
5.3.240.0030.06014.74
5.3.230.0130.04314.74
5.3.220.0030.05714.55
5.3.210.0000.05714.67
5.3.200.0100.06714.64
5.3.190.0030.06714.57
5.3.180.0030.05014.43
5.3.170.0070.06014.65
5.3.160.0030.06714.65
5.3.150.0130.05014.72
5.3.140.0070.06314.54
5.3.130.0030.07714.63
5.3.120.0030.05714.41
5.3.110.0100.06314.53
5.3.100.0130.06314.09
5.3.90.0170.06314.01
5.3.80.0070.06014.11
5.3.70.0070.04714.10
5.3.60.0000.07014.09
5.3.50.0070.06313.96
5.3.40.0070.05013.93
5.3.30.0000.05314.05
5.3.20.0070.05313.78
5.3.10.0030.05013.66
5.3.00.0070.06013.72
5.2.170.0030.04311.31
5.2.160.0100.04711.13
5.2.150.0030.04311.18
5.2.140.0170.03711.30
5.2.130.0030.04711.20
5.2.120.0000.04011.29
5.2.110.0000.05711.20
5.2.100.0000.04011.24
5.2.90.0000.06010.94
5.2.80.0030.05011.17
5.2.70.0070.05310.93
5.2.60.0030.04011.03
5.2.50.0000.04711.20
5.2.40.0030.05010.96
5.2.30.0030.04311.13
5.2.20.0030.04010.94
5.2.10.0000.04010.84
5.2.00.0100.03710.73
5.1.60.0030.03310.24
5.1.50.0000.03710.24
5.1.40.0000.03710.24
5.1.30.0000.05310.50
5.1.20.0100.03310.36
5.1.10.0000.03710.24
5.1.00.0070.03310.24
5.0.50.0070.03310.24
5.0.40.0000.03010.24
5.0.30.0030.04310.24
5.0.20.0000.02710.24
5.0.10.0000.02710.24
5.0.00.0130.04010.24
4.4.90.0000.02310.24
4.4.80.0030.02010.24
4.4.70.0070.01710.24
4.4.60.0000.02310.24
4.4.50.0030.02710.24
4.4.40.0000.03710.24
4.4.30.0030.02010.24
4.4.20.0030.02310.24
4.4.10.0070.02310.24
4.4.00.0000.03710.24
4.3.110.0000.02710.24
4.3.100.0030.02010.24
4.3.90.0070.01710.24
4.3.80.0030.03710.24
4.3.70.0030.03010.24
4.3.60.0000.03010.24
4.3.50.0030.02710.24
4.3.40.0000.04710.24
4.3.30.0030.02310.24
4.3.20.0000.02710.24
4.3.10.0070.02010.24
4.3.00.0170.0206.60

preferences:
40.34 ms | 401 KiB | 5 Q