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(){ $this->secret = "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.0070.01418.55
8.3.50.0100.00922.11
8.3.40.0080.01118.88
8.3.30.0140.00020.39
8.3.20.0080.00020.29
8.3.10.0040.00421.92
8.3.00.0050.00322.37
8.2.180.0190.00016.50
8.2.170.0120.00618.95
8.2.160.0150.00022.96
8.2.150.0000.00824.18
8.2.140.0080.00024.66
8.2.130.0000.00726.16
8.2.120.0000.00820.58
8.2.110.0030.00620.52
8.2.100.0120.00018.03
8.2.90.0050.00319.19
8.2.80.0050.00319.30
8.2.70.0000.00817.75
8.2.60.0000.00818.05
8.2.50.0060.00318.07
8.2.40.0080.00018.34
8.2.30.0050.00318.21
8.2.20.0050.00217.82
8.2.10.0060.00317.94
8.2.00.0070.00017.82
8.1.280.0080.00825.92
8.1.270.0040.00423.99
8.1.260.0070.00726.35
8.1.250.0060.00328.09
8.1.240.0000.00923.80
8.1.230.0040.00822.81
8.1.220.0040.00417.74
8.1.210.0050.00318.77
8.1.200.0100.00017.35
8.1.190.0080.00017.55
8.1.180.0000.00819.99
8.1.170.0030.00618.41
8.1.160.0040.00422.23
8.1.150.0050.00318.58
8.1.140.0000.00717.54
8.1.130.0080.00017.77
8.1.120.0040.00417.44
8.1.110.0080.00017.52
8.1.100.0000.00717.54
8.1.90.0020.00517.39
8.1.80.0020.00517.50
8.1.70.0000.00817.43
8.1.60.0030.00617.63
8.1.50.0040.00417.62
8.1.40.0080.00017.53
8.1.30.0000.00817.53
8.1.20.0030.00517.69
8.1.10.0070.00017.54
8.1.00.0040.00417.54
8.0.300.0080.00018.77
8.0.290.0000.00717.18
8.0.280.0040.00418.39
8.0.270.0030.00317.16
8.0.260.0000.00716.76
8.0.250.0030.00317.02
8.0.240.0100.00017.04
8.0.230.0000.00716.94
8.0.220.0030.00316.95
8.0.210.0030.00317.00
8.0.200.0030.00317.05
8.0.190.0000.00717.02
8.0.180.0040.00416.88
8.0.170.0000.00716.98
8.0.160.0040.00416.99
8.0.150.0060.00317.01
8.0.140.0070.00016.98
8.0.130.0000.00613.37
8.0.120.0040.00416.85
8.0.110.0000.00717.02
8.0.100.0080.00017.04
8.0.90.0040.00416.81
8.0.80.0040.01117.03
8.0.70.0040.00416.89
8.0.60.0070.00016.80
8.0.50.0020.00516.93
8.0.30.0110.00717.23
8.0.20.0140.00517.40
8.0.10.0050.00317.01
8.0.00.0140.00816.68
7.4.330.0050.00015.00
7.4.320.0070.00016.62
7.4.300.0000.00616.66
7.4.290.0000.00716.67
7.4.280.0030.00316.62
7.4.270.0000.00716.55
7.4.260.0030.00316.45
7.4.250.0040.00416.51
7.4.240.0030.00416.65
7.4.230.0070.00016.70
7.4.220.0160.00716.48
7.4.210.0080.00816.59
7.4.200.0040.00416.57
7.4.190.0050.00216.76
7.4.160.0070.01316.79
7.4.150.0000.01717.40
7.4.140.0070.01117.86
7.4.130.0100.00916.48
7.4.120.0070.01016.65
7.4.110.0040.01316.55
7.4.100.0090.00916.65
7.4.90.0120.00916.52
7.4.80.0120.00619.39
7.4.70.0060.01116.49
7.4.60.0060.00916.71
7.4.50.0020.00216.48
7.4.40.0070.01022.77
7.4.30.0100.00716.61
7.4.10.0070.01215.71
7.4.00.0050.01315.32
7.3.330.0050.00013.48
7.3.320.0030.00313.46
7.3.310.0000.00716.31
7.3.300.0030.00316.32
7.3.290.0070.00716.37
7.3.280.0070.00916.44
7.3.270.0070.01117.40
7.3.260.0090.01216.73
7.3.250.0090.01116.44
7.3.240.0100.00616.55
7.3.230.0080.00816.39
7.3.210.0080.00816.63
7.3.200.0090.00919.39
7.3.190.0150.00316.32
7.3.180.0110.00516.51
7.3.170.0060.00916.55
7.3.160.0130.00316.40
7.3.130.0110.00615.81
7.3.120.0110.00715.19
7.3.110.0080.01015.55
7.3.100.0070.00915.35
7.3.90.0070.00915.45
7.3.80.0050.00915.39
7.3.70.0090.00615.46
7.3.60.0060.00815.33
7.3.50.0040.00815.24
7.3.40.0050.00915.26
7.3.30.0070.00615.34
7.3.20.0070.00617.24
7.3.10.0040.00917.16
7.3.00.0060.00917.08
7.2.330.0120.01216.83
7.2.320.0180.00016.73
7.2.310.0070.01616.41
7.2.300.0140.00316.53
7.2.290.0120.00316.68
7.2.260.0100.00815.99
7.2.250.0080.01015.59
7.2.240.0110.00615.54
7.2.230.0090.01015.37
7.2.220.0090.00915.70
7.2.210.0060.00715.65
7.2.200.0030.01015.50
7.2.190.0050.00815.43
7.2.180.0090.00415.55
7.2.170.0030.00815.57
7.2.160.0100.00315.73
7.2.150.0030.00917.81
7.2.140.0060.00717.71
7.2.130.0080.00617.43
7.2.120.0050.00717.38
7.2.110.0070.00717.40
7.2.100.0070.00917.46
7.2.90.0080.00717.40
7.2.80.0070.00617.46
7.2.70.0080.00517.55
7.2.60.0030.01017.16
7.2.50.0070.00617.40
7.2.40.0060.00917.63
7.2.30.0030.01017.32
7.2.20.0050.00817.26
7.2.10.0050.00817.50
7.2.00.0040.01017.90
7.1.330.0040.00916.22
7.1.320.0060.00916.44
7.1.310.0050.01016.28
7.1.300.0100.00216.27
7.1.290.0030.00816.32
7.1.280.0050.00816.28
7.1.270.0030.00916.20
7.1.260.0070.00716.29
7.1.250.0070.00616.13
7.1.240.0090.00616.58
7.1.230.0060.00716.52
7.1.220.0050.00516.58
7.1.210.0090.00616.58
7.1.200.0070.00516.36
7.1.190.0080.00416.48
7.1.180.0050.00816.55
7.1.170.0040.01016.53
7.1.160.0080.00716.50
7.1.150.0060.00616.43
7.1.140.0010.00916.68
7.1.130.0050.00616.63
7.1.120.0070.00916.56
7.1.110.0070.00616.63
7.1.100.0080.00416.77
7.1.90.0090.00716.60
7.1.80.0060.00716.62
7.1.70.0060.00716.81
7.1.60.0080.00717.40
7.1.50.0080.01016.74
7.1.40.0080.00716.56
7.1.30.0090.00516.70
7.1.20.0070.00316.47
7.1.10.0050.00916.50
7.1.00.0020.03018.42
7.0.330.0090.00516.15
7.0.320.0030.00916.35
7.0.310.0050.00716.19
7.0.300.0140.00216.13
7.0.290.0050.01016.30
7.0.280.0030.00916.20
7.0.270.0070.00616.11
7.0.260.0080.00316.16
7.0.250.0060.00616.30
7.0.240.0110.00316.13
7.0.230.0040.01116.29
7.0.220.0060.00816.36
7.0.210.0030.01016.19
7.0.200.0060.01116.41
7.0.190.0050.01116.22
7.0.180.0080.00616.25
7.0.170.0080.00516.09
7.0.160.0080.00316.16
7.0.150.0090.00416.15
7.0.140.0030.02918.16
7.0.130.0090.00616.25
7.0.120.0040.00916.27
7.0.110.0070.00516.27
7.0.100.0070.00716.20
7.0.90.0100.00316.21
7.0.80.0060.00616.13
7.0.70.0090.00516.17
7.0.60.0020.03817.52
7.0.50.0110.02716.88
7.0.40.0070.01916.19
7.0.30.0160.02616.23
7.0.20.0140.02916.17
7.0.10.0050.03016.28
7.0.00.0060.01916.18
5.6.400.0050.00815.42
5.6.390.0080.00315.31
5.6.380.0110.00515.23
5.6.370.0060.00715.15
5.6.360.0070.00915.26
5.6.350.0070.00615.24
5.6.340.0030.01015.24
5.6.330.0050.00815.41
5.6.320.0100.00415.20
5.6.310.0080.00615.25
5.6.300.0060.00815.30
5.6.290.0070.00815.29
5.6.280.0050.02917.19
5.6.270.0070.00515.24
5.6.260.0090.00215.18
5.6.250.0030.01015.31
5.6.240.0050.00915.29
5.6.230.0050.00715.16
5.6.220.0080.00815.37
5.6.210.0070.02917.07
5.6.200.0050.02216.14
5.6.190.0060.02316.92
5.6.180.0170.02817.03
5.6.170.0180.01717.15
5.6.160.0050.03617.03
5.6.150.0110.01616.28
5.6.140.0040.03316.22
5.6.130.0050.03116.28
5.6.120.0090.02617.09
5.6.110.0100.02317.16
5.6.100.0130.02617.21
5.6.90.0050.03417.21
5.6.80.0050.01816.93
5.6.70.1510.01816.89
5.6.60.0070.00715.02
5.6.50.0030.01015.20
5.6.40.0080.00515.01
5.6.30.0030.01015.17
5.6.20.0030.01215.23
5.6.10.0070.01015.28
5.6.00.0030.01015.15
5.5.380.0080.00715.08
5.5.370.0050.00714.95
5.5.360.0060.00715.13
5.5.350.0040.02616.93
5.5.340.0090.02616.10
5.5.330.0070.03116.92
5.5.320.0100.03316.85
5.5.310.0130.02917.04
5.5.300.0050.03216.10
5.5.290.0030.03416.09
5.5.280.0080.03216.96
5.5.270.0040.02416.95
5.5.260.0060.03317.18
5.5.250.0070.02916.91
5.5.240.0060.01716.85
5.5.230.0100.00315.13
5.5.220.0060.00814.94
5.5.210.0030.00815.09
5.5.200.0100.00515.15
5.5.190.0070.00515.15
5.5.180.0080.00715.18
5.5.170.0080.00815.15
5.5.160.0060.00715.15
5.5.150.0040.00915.07
5.5.140.0050.00915.14
5.5.130.0100.00814.88
5.5.120.0050.00815.03
5.5.110.0080.00415.03
5.5.100.0080.00614.98
5.5.90.0050.01015.15
5.5.80.0040.01215.03
5.5.70.0050.00814.85
5.5.60.0050.01115.11
5.5.50.0030.00914.95
5.5.40.0040.01015.15
5.5.30.0060.00715.11
5.5.20.0080.00515.12
5.5.10.0030.01415.03
5.5.00.0060.00815.05
5.4.450.0240.02514.77
5.4.440.0240.02314.72
5.4.430.0250.02214.85
5.4.420.0270.02414.78
5.4.410.0060.02114.86
5.4.400.0350.02914.56
5.4.390.0390.02014.47
5.4.380.0140.01614.53
5.4.370.0110.02014.47
5.4.360.0090.01914.55
5.4.350.0030.01912.28
5.4.340.0050.02012.28
5.4.330.0030.01012.48
5.4.320.0050.01512.44
5.4.310.0070.01612.49
5.4.300.0040.02012.45
5.4.290.0040.02012.44
5.4.280.0070.01912.41
5.4.270.0050.01612.41
5.4.260.0050.01612.48
5.4.250.0100.02014.52
5.4.240.0060.02614.55
5.4.230.0040.02614.58
5.4.220.0060.02214.60
5.4.210.0050.02214.57
5.4.200.0120.01614.59
5.4.190.0080.02214.57
5.4.180.0060.02814.57
5.4.170.0080.02414.58
5.4.160.0090.02014.62
5.4.150.0030.02314.55
5.4.140.0100.02613.79
5.4.130.0050.02113.77
5.4.120.0050.02213.73
5.4.110.0080.02813.73
5.4.100.0040.01913.82
5.4.90.0080.02113.77
5.4.80.0030.02913.73
5.4.70.0040.02413.76
5.4.60.0060.02513.76
5.4.50.0060.02013.73
5.4.40.0070.02413.78
5.4.30.0070.02113.79
5.4.20.0060.02513.74
5.4.10.0070.02313.73
5.4.00.0050.02013.52
5.3.290.0060.01712.78
5.3.280.0070.02713.23
5.3.270.0100.01913.30
5.3.260.0090.01913.33
5.3.250.0040.02713.30
5.3.240.0040.02813.29
5.3.230.0020.03013.24
5.3.220.0080.02313.27
5.3.210.0050.02713.16
5.3.200.0050.02613.22
5.3.190.0010.02413.20
5.3.180.0010.02713.35
5.3.170.0060.02213.32
5.3.160.0070.02213.31
5.3.150.0050.02313.30
5.3.140.0030.02813.32
5.3.130.0050.02313.18
5.3.120.0090.02813.20
5.3.110.0020.03113.27
5.3.100.0050.02513.04
5.3.90.0040.02913.03
5.3.80.0060.02113.13
5.3.70.0050.01913.10
5.3.60.0070.01613.04
5.3.50.0030.02012.96
5.3.40.0070.02213.10
5.3.30.0060.02613.08
5.3.20.0020.02812.90
5.3.10.0060.02512.87
5.3.00.0030.02712.80
5.2.170.0030.04011.13
5.2.160.0000.04010.98
5.2.150.0000.06711.22
5.2.140.0070.04711.23
5.2.130.0030.04311.09
5.2.120.0070.03711.20
5.2.110.0070.05311.18
5.2.100.0070.03711.23
5.2.90.0070.05011.18
5.2.80.0030.05711.07
5.2.70.0070.05711.25
5.2.60.0070.05311.23
5.2.50.0100.04711.05
5.2.40.0130.03711.09
5.2.30.0130.04711.16
5.2.20.0170.03710.98
5.2.10.0030.05010.95
5.2.00.0030.04010.82
5.1.60.0070.04310.24
5.1.50.0000.04710.24
5.1.40.0000.03310.24
5.1.30.0070.03310.31
5.1.20.0030.03710.39
5.1.10.0030.03310.24
5.1.00.0000.04010.24
5.0.50.0000.03010.24
5.0.40.0070.02710.24
5.0.30.0000.04310.24
5.0.20.0030.03710.24
5.0.10.0000.04010.24
5.0.00.0030.05010.24
4.4.90.0000.02710.24
4.4.80.0030.03010.24
4.4.70.0030.02710.24
4.4.60.0000.02310.24
4.4.50.0030.02710.24
4.4.40.0030.04310.24
4.4.30.0000.02310.24
4.4.20.0000.02310.24
4.4.10.0000.02310.24
4.4.00.0030.03010.24
4.3.110.0030.02010.24
4.3.100.0030.01710.24
4.3.90.0070.02010.24
4.3.80.0000.04010.24
4.3.70.0030.02310.24
4.3.60.0000.02010.24
4.3.50.0030.01710.24
4.3.40.0000.03710.24
4.3.30.0000.03310.24
4.3.20.0030.02710.24
4.3.10.0070.01710.24
4.3.00.0100.0206.09

preferences:
42.86 ms | 401 KiB | 5 Q