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 = "callback"; } 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.0120.00918.87
8.3.30.0100.00320.17
8.3.20.0070.00020.35
8.3.10.0040.00422.04
8.3.00.0000.00822.43
8.2.170.0090.00622.96
8.2.160.0070.00720.38
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0090.00026.16
8.2.120.0000.00819.64
8.2.110.0030.00622.23
8.2.100.0110.00019.34
8.2.90.0050.00319.35
8.2.80.0040.00419.28
8.2.70.0060.00317.72
8.2.60.0000.00818.16
8.2.50.0000.00918.07
8.2.40.0030.00518.34
8.2.30.0080.00018.06
8.2.20.0000.00717.86
8.2.10.0000.00717.74
8.2.00.0000.00817.70
8.1.270.0040.00422.02
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0070.00323.88
8.1.230.0110.00019.00
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0060.00317.35
8.1.190.0060.00317.52
8.1.180.0040.00420.25
8.1.170.0090.00018.53
8.1.160.0020.00522.09
8.1.150.0020.00518.66
8.1.140.0040.00417.48
8.1.130.0000.00817.82
8.1.120.0040.00417.42
8.1.110.0000.00817.49
8.1.100.0050.00317.47
8.1.90.0070.00017.48
8.1.80.0040.00417.50
8.1.70.0000.00717.49
8.1.60.0050.00317.61
8.1.50.0080.00017.54
8.1.40.0040.00417.54
8.1.30.0030.00517.50
8.1.20.0040.00417.66
8.1.10.0080.00017.57
8.1.00.0030.00617.57
8.0.300.0080.00018.77
8.0.290.0040.00417.05
8.0.280.0090.00018.45
8.0.270.0070.00017.29
8.0.260.0060.00016.82
8.0.250.0070.00016.91
8.0.240.0040.00716.96
8.0.230.0070.00017.04
8.0.220.0020.00517.01
8.0.210.0040.00416.80
8.0.200.0000.00717.03
8.0.190.0040.00417.09
8.0.180.0070.00017.03
8.0.170.0080.00016.90
8.0.160.0040.00316.95
8.0.150.0000.00816.91
8.0.140.0000.00716.85
8.0.130.0000.00613.37
8.0.120.0070.00016.94
8.0.110.0000.00716.96
8.0.100.0070.00016.92
8.0.90.0040.00416.86
8.0.80.0060.00916.92
8.0.70.0040.00416.94
8.0.60.0040.00416.98
8.0.50.0070.00016.91
8.0.30.0180.00417.22
8.0.20.0090.01117.42
8.0.10.0040.00417.21
8.0.00.0120.00516.77
7.4.330.0050.00015.00
7.4.320.0030.00316.51
7.4.300.0030.00316.61
7.4.290.0040.00416.63
7.4.280.0030.00316.66
7.4.270.0000.00716.64
7.4.260.0050.00316.50
7.4.250.0040.00416.44
7.4.240.0000.00716.53
7.4.230.0030.00316.70
7.4.220.0090.00616.47
7.4.210.0100.00716.61
7.4.200.0040.00416.71
7.4.190.0030.00316.79
7.4.160.0150.00016.71
7.4.150.0100.00717.40
7.4.140.0100.01217.86
7.4.130.0070.01116.51
7.4.120.0050.01216.58
7.4.110.0090.00616.54
7.4.100.0030.01516.55
7.4.90.0140.00716.59
7.4.80.0070.01019.39
7.4.70.0090.01216.56
7.4.60.0140.00416.36
7.4.50.0090.00016.73
7.4.40.0070.00722.77
7.4.30.0100.01316.62
7.4.10.0100.01015.07
7.4.00.0050.00814.83
7.3.330.0000.00513.32
7.3.320.0030.00313.39
7.3.310.0000.00716.43
7.3.300.0030.00316.25
7.3.290.0110.00516.30
7.3.280.0100.00716.36
7.3.270.0110.00617.40
7.3.260.0130.00616.41
7.3.250.0110.00916.65
7.3.240.0060.01116.63
7.3.230.0060.01016.61
7.3.210.0140.00316.45
7.3.200.0030.01319.39
7.3.190.0070.01016.61
7.3.180.0110.00416.66
7.3.170.0070.01016.48
7.3.160.0030.01316.51
7.3.130.0090.00914.98
7.3.120.0070.00914.91
7.3.110.0080.01114.75
7.3.100.0100.00614.96
7.3.90.0070.00914.93
7.3.80.0040.00714.82
7.3.70.0020.01014.85
7.3.60.0060.00914.73
7.3.50.0060.00914.78
7.3.40.0070.00614.72
7.3.30.0090.00514.83
7.3.20.0070.00416.72
7.3.10.0040.00916.71
7.3.00.0050.00616.68
7.2.330.0100.00716.84
7.2.320.0090.01316.59
7.2.310.0090.01516.77
7.2.300.0040.01216.75
7.2.290.0030.01316.59
7.2.260.0040.01514.93
7.2.250.0080.01014.97
7.2.240.0030.01515.25
7.2.230.0100.00614.94
7.2.220.0090.00715.05
7.2.210.0040.00815.04
7.2.200.0040.01115.06
7.2.190.0020.01115.12
7.2.180.0060.00915.06
7.2.170.0050.00715.13
7.2.160.0100.00714.99
7.2.150.0070.01016.87
7.2.140.0040.01116.60
7.2.130.0060.00616.94
7.2.120.0030.01017.07
7.2.110.0090.00616.83
7.2.100.0070.01016.89
7.2.90.0030.00916.91
7.2.80.0080.00616.63
7.2.70.0100.00316.71
7.2.60.0070.00317.06
7.2.50.0080.00616.67
7.2.40.0030.01317.02
7.2.30.0000.01317.07
7.2.20.0060.00916.87
7.2.10.0040.00816.91
7.2.00.0110.00318.16
7.1.330.0100.00415.93
7.1.320.0060.00615.82
7.1.310.0080.00715.75
7.1.300.0030.00815.86
7.1.290.0080.00615.70
7.1.280.0060.00815.87
7.1.270.0110.00315.82
7.1.260.0050.00615.57
7.1.250.0060.00316.00
7.1.240.0080.00415.76
7.1.230.0060.00315.89
7.1.220.0080.00415.93
7.1.210.0000.01515.72
7.1.200.0030.01015.69
7.1.190.0000.01115.84
7.1.180.0060.00815.90
7.1.170.0090.01215.88
7.1.160.0100.00715.77
7.1.150.0030.01015.87
7.1.140.0040.00715.88
7.1.130.0100.00315.84
7.1.120.0060.00315.82
7.1.110.0050.00315.72
7.1.100.0020.01016.87
7.1.90.0070.00715.84
7.1.80.0090.00315.51
7.1.70.0020.00816.56
7.1.60.0110.00717.40
7.1.50.0050.01216.23
7.1.40.0000.00915.81
7.1.30.0000.01115.89
7.1.20.0070.00715.77
7.1.10.0060.00615.61
7.1.00.0040.03519.05
7.0.330.0100.00315.23
7.0.320.0090.00315.30
7.0.310.0000.01315.01
7.0.300.0000.01015.27
7.0.290.0060.01015.22
7.0.280.0040.01115.16
7.0.270.0070.01015.36
7.0.260.0040.00715.09
7.0.250.0060.00315.50
7.0.240.0030.00715.20
7.0.230.0060.00315.43
7.0.220.0090.00615.56
7.0.210.0030.00615.51
7.0.200.0050.01116.12
7.0.190.0040.00815.39
7.0.180.0040.00815.50
7.0.170.0040.00415.38
7.0.160.0130.00015.25
7.0.150.0030.01015.20
7.0.140.0090.03718.62
7.0.130.0060.00315.47
7.0.120.0030.00715.40
7.0.110.0040.00815.15
7.0.100.0070.00715.42
7.0.90.0060.00615.36
7.0.80.0060.00615.25
7.0.70.0030.00615.02
7.0.60.0190.02217.68
7.0.50.0050.03016.61
7.0.40.0080.04216.91
7.0.30.0130.02516.76
7.0.20.0230.04216.84
7.0.10.0100.04316.89
7.0.00.0120.02716.84
5.6.400.0030.01014.45
5.6.390.0040.00714.13
5.6.380.0050.00314.29
5.6.370.0060.00314.59
5.6.360.0140.00714.53
5.6.350.0090.00014.66
5.6.340.0060.00614.56
5.6.330.0030.00714.65
5.6.320.0040.00714.64
5.6.310.0030.00614.58
5.6.300.0080.00414.55
5.6.290.0080.00514.64
5.6.280.0070.03717.80
5.6.270.0070.00314.27
5.6.260.0030.01014.52
5.6.250.0060.00914.60
5.6.240.0060.00614.64
5.6.230.0040.01114.55
5.6.220.0100.00314.54
5.6.210.0060.03417.57
5.6.200.0020.03716.48
5.6.190.0080.04017.57
5.6.180.0100.02817.39
5.6.170.0120.02917.36
5.6.160.0100.04417.61
5.6.150.0060.04516.54
5.6.140.0080.02316.25
5.6.130.0050.04216.37
5.6.120.0060.02617.75
5.6.110.0080.04317.82
5.6.100.0070.03617.68
5.6.90.0030.02717.70
5.6.80.0070.03517.49
5.6.70.0110.00314.36
5.6.60.0090.00614.37
5.6.50.0020.01114.29
5.6.40.0130.00314.18
5.6.30.0030.00914.49
5.6.20.0100.00714.60
5.6.10.0120.00314.43
5.6.00.0090.00614.52
5.5.380.0070.00714.45
5.5.370.0040.00414.44
5.5.360.0060.00914.58
5.5.350.0090.03517.35
5.5.340.0080.03416.26
5.5.330.0070.04717.30
5.5.320.0060.04717.24
5.5.310.0150.03417.35
5.5.300.0110.03416.31
5.5.290.0070.04716.11
5.5.280.0030.02817.57
5.5.270.0050.04617.68
5.5.260.0020.02917.46
5.5.250.0090.03317.46
5.5.240.0070.02317.24
5.5.230.0040.01114.10
5.5.220.0140.00014.49
5.5.210.0060.00614.34
5.5.200.0030.01414.13
5.5.190.0030.01314.22
5.5.180.0120.00314.09
5.5.170.0030.01014.36
5.5.160.0130.00314.42
5.5.150.0030.00714.35
5.5.140.0050.00914.36
5.5.130.0030.01314.22
5.5.120.0090.00414.34
5.5.110.0100.00314.11
5.5.100.0130.00014.18
5.5.90.0090.00314.50
5.5.80.0090.00314.38
5.5.70.0080.00014.13
5.5.60.0100.00714.41
5.5.50.0000.01413.89
5.5.40.0060.00614.48
5.5.30.0100.00614.07
5.5.20.0030.00614.07
5.5.10.0040.00814.30
5.5.00.0030.01314.35
5.4.450.0230.02815.44
5.4.440.0210.02415.44
5.4.430.0140.01515.43
5.4.420.0200.02315.39
5.4.410.0180.02315.31
5.4.400.0180.02215.32
5.4.390.0130.02715.31
5.4.380.0600.02815.10
5.4.370.0590.02715.10
5.4.360.0680.03815.00
5.4.350.0480.03014.98
5.4.340.0380.03715.02
5.4.330.0000.01011.47
5.4.320.0080.02211.99
5.4.310.0040.02511.99
5.4.300.0030.02211.99
5.4.290.0070.02311.99
5.4.280.0040.02311.93
5.4.270.0060.01911.94
5.4.260.0060.02011.94
5.4.250.0050.03815.25
5.4.240.0050.03715.19
5.4.230.0100.03415.25
5.4.220.0050.03315.22
5.4.210.0100.03015.10
5.4.200.0030.03715.10
5.4.190.0080.03615.10
5.4.180.0120.03415.10
5.4.170.0110.02715.12
5.4.160.0030.03315.20
5.4.150.0060.02815.19
5.4.140.0070.02913.95
5.4.130.0130.03013.98
5.4.120.0050.04013.95
5.4.110.0070.03413.89
5.4.100.0030.02813.92
5.4.90.0030.03013.91
5.4.80.0060.03513.93
5.4.70.0080.02313.91
5.4.60.0030.03313.96
5.4.50.0050.02713.91
5.4.40.0050.02413.91
5.4.30.0080.02313.98
5.4.20.0040.02914.00
5.4.10.0060.03013.97
5.4.00.0020.03813.64
5.3.290.0040.02612.14
5.3.280.0060.03212.96
5.3.270.0140.02913.03
5.3.260.0050.02813.03
5.3.250.0040.03412.97
5.3.240.0070.03712.96
5.3.230.0070.03013.07
5.3.220.0030.02613.06
5.3.210.0060.02513.01
5.3.200.0030.04113.07
5.3.190.0020.03413.08
5.3.180.0030.02613.06
5.3.170.0030.02813.06
5.3.160.0060.02313.10
5.3.150.0080.03013.01
5.3.140.0010.04313.01
5.3.130.0050.02613.06
5.3.120.0020.04213.09
5.3.110.0050.02913.00
5.3.100.0090.02712.82
5.3.90.0020.03212.83
5.3.80.0080.03012.74
5.3.70.0020.03212.75
5.3.60.0050.03512.77
5.3.50.0040.03312.63
5.3.40.0050.02812.78
5.3.30.0050.03512.74
5.3.20.0100.02312.63
5.3.10.0030.02612.63
5.3.00.0030.03512.54
5.2.170.0000.04711.17
5.2.160.0030.04310.98
5.2.150.0030.05011.33
5.2.140.0100.04311.28
5.2.130.0070.03711.20
5.2.120.0030.03711.29
5.2.110.0000.05011.10
5.2.100.0000.05311.23
5.2.90.0030.04311.19
5.2.80.0000.05710.96
5.2.70.0000.05011.25
5.2.60.0030.05711.15
5.2.50.0000.04310.86
5.2.40.0070.03311.13
5.2.30.0070.04010.80
5.2.20.0070.04311.04
5.2.10.0030.05011.00
5.2.00.0030.05010.86
5.1.60.0100.04310.24
5.1.50.0070.03010.24
5.1.40.0000.04710.24
5.1.30.0000.03710.31
5.1.20.0030.04710.34
5.1.10.0030.04310.24
5.1.00.0030.05010.24
5.0.50.0000.03010.24
5.0.40.0070.02310.24
5.0.30.0070.04710.24
5.0.20.0030.03010.24
5.0.10.0070.02710.24
5.0.00.0000.04310.24
4.4.90.0030.02710.24
4.4.80.0070.02310.24
4.4.70.0030.02310.24
4.4.60.0000.02710.24
4.4.50.0030.02310.24
4.4.40.0000.03310.24
4.4.30.0000.02310.24
4.4.20.0100.02010.24
4.4.10.0030.02010.24
4.4.00.0000.03310.24
4.3.110.0000.02310.24
4.3.100.0000.02310.24
4.3.90.0030.02310.24
4.3.80.0000.03310.24
4.3.70.0070.01710.24
4.3.60.0070.01710.24
4.3.50.0070.02310.24
4.3.40.0000.03310.24
4.3.30.0030.02010.24
4.3.20.0030.02310.24
4.3.10.0000.03010.24
4.3.00.0030.01314.48

preferences:
72.64 ms | 400 KiB | 5 Q