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"; } } } $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.70.0070.00718.39
8.3.60.0130.00618.43
8.3.50.0080.00821.21
8.3.40.0040.01118.57
8.3.30.0120.00320.29
8.3.20.0030.00620.30
8.3.10.0000.00822.09
8.3.00.0040.00422.37
8.2.180.0150.00718.31
8.2.170.0090.00622.96
8.2.160.0100.00320.47
8.2.150.0040.00424.18
8.2.140.0030.00624.66
8.2.130.0000.00826.16
8.2.120.0050.00319.66
8.2.110.0030.00622.20
8.2.100.0030.00719.41
8.2.90.0040.00419.34
8.2.80.0050.00619.39
8.2.70.0090.00017.46
8.2.60.0070.00518.05
8.2.50.0000.00818.07
8.2.40.0030.00618.16
8.2.30.0040.00418.21
8.2.20.0000.00717.71
8.2.10.0050.00317.73
8.2.00.0060.00317.82
8.1.280.0070.00725.92
8.1.270.0080.00024.66
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0080.00323.79
8.1.230.0000.01119.07
8.1.220.0000.00817.79
8.1.210.0080.00018.77
8.1.200.0030.00617.13
8.1.190.0050.00317.52
8.1.180.0030.00520.20
8.1.170.0090.00018.50
8.1.160.0000.00722.03
8.1.150.0050.00318.65
8.1.140.0000.00817.40
8.1.130.0100.00017.90
8.1.120.0000.00717.44
8.1.110.0000.00717.43
8.1.100.0040.00417.51
8.1.90.0070.00017.53
8.1.80.0000.00717.46
8.1.70.0000.00717.37
8.1.60.0000.00817.63
8.1.50.0020.00517.43
8.1.40.0030.00517.57
8.1.30.0000.00717.68
8.1.20.0050.00317.59
8.1.10.0060.00317.46
8.1.00.0040.00717.45
8.0.300.0040.00418.77
8.0.290.0040.00416.93
8.0.280.0070.00018.38
8.0.270.0000.00717.19
8.0.260.0050.00316.86
8.0.250.0030.00317.04
8.0.240.0030.00717.07
8.0.230.0040.00416.91
8.0.220.0030.00516.87
8.0.210.0000.00716.96
8.0.200.0040.00416.97
8.0.190.0000.00717.04
8.0.180.0060.00617.04
8.0.170.0030.00516.96
8.0.160.0050.00216.95
8.0.150.0030.00316.88
8.0.140.0030.00616.82
8.0.130.0000.00513.45
8.0.120.0070.00017.00
8.0.110.0030.00516.85
8.0.100.0000.00716.97
8.0.90.0000.00716.82
8.0.80.0070.01016.94
8.0.70.0000.00716.90
8.0.60.0070.00016.86
8.0.50.0040.00416.97
8.0.30.0180.00517.23
8.0.20.0100.01017.40
8.0.10.0040.00416.96
8.0.00.0120.00816.88
7.4.330.0050.00015.00
7.4.320.0030.00316.54
7.4.300.0030.00316.57
7.4.290.0070.00016.57
7.4.280.0000.00716.61
7.4.270.0030.00316.54
7.4.260.0040.00416.64
7.4.250.0070.00016.59
7.4.240.0030.00416.59
7.4.230.0030.00316.69
7.4.220.0120.00316.48
7.4.210.0060.00716.61
7.4.200.0000.00716.33
7.4.190.0000.00816.75
7.4.160.0130.00716.64
7.4.150.0140.01017.40
7.4.140.0100.00817.86
7.4.130.0130.00616.54
7.4.120.0110.00716.55
7.4.110.0070.01016.47
7.4.100.0070.01016.43
7.4.90.0080.01116.54
7.4.80.0090.01019.39
7.4.70.0110.01016.59
7.4.60.0140.00416.59
7.4.50.0030.00616.46
7.4.40.0060.01222.77
7.4.30.0060.01516.72
7.4.00.0070.01215.07
7.3.330.0000.00613.40
7.3.320.0000.00513.26
7.3.310.0040.00416.38
7.3.300.0030.00316.43
7.3.290.0070.00716.32
7.3.280.0070.01216.37
7.3.270.0120.00917.40
7.3.260.0140.00916.36
7.3.250.0140.01016.61
7.3.240.0070.01516.40
7.3.230.0060.01116.39
7.3.210.0150.00616.38
7.3.200.0100.00719.39
7.3.190.0080.00816.38
7.3.180.0030.01316.48
7.3.170.0090.00916.61
7.3.160.0040.01216.55
7.3.120.0080.00814.97
7.3.110.0070.01214.84
7.3.100.0070.01114.73
7.3.90.0060.00714.82
7.3.80.0060.00514.71
7.3.70.0070.01014.93
7.3.60.0040.00714.95
7.3.50.0060.00914.67
7.3.40.0060.00714.87
7.3.30.0050.00914.90
7.3.20.0030.00916.58
7.3.10.0040.01016.49
7.3.00.0070.00416.71
7.2.330.0100.00716.50
7.2.320.0060.00916.82
7.2.310.0090.01216.80
7.2.300.0080.01116.60
7.2.290.0100.00716.85
7.2.250.0100.00615.04
7.2.240.0120.00714.81
7.2.230.0050.00915.08
7.2.220.0040.01314.99
7.2.210.0080.00615.12
7.2.200.0060.00714.97
7.2.190.0040.00915.05
7.2.180.0030.01114.99
7.2.170.0070.00614.93
7.2.160.0050.00715.19
7.2.150.0090.00516.86
7.2.140.0000.01317.07
7.2.130.0050.00616.89
7.2.120.0110.00517.01
7.2.110.0080.00816.99
7.2.100.0020.01116.79
7.2.90.0050.00716.99
7.2.80.0070.00716.84
7.2.70.0070.00616.75
7.2.60.0080.00716.65
7.2.50.0120.00217.00
7.2.40.0060.00916.81
7.2.30.0120.00116.93
7.2.20.0030.00817.15
7.2.10.0100.00516.95
7.2.00.0060.00717.65
7.1.330.0070.01016.01
7.1.320.0030.01115.82
7.1.310.0080.00515.76
7.1.300.0050.00915.78
7.1.290.0040.01215.77
7.1.280.0040.00815.64
7.1.270.0060.00815.78
7.1.260.0110.00015.79
7.1.250.0010.01415.67
7.1.240.0000.01415.77
7.1.230.0080.00615.66
7.1.220.0040.00615.51
7.1.210.0070.00515.72
7.1.200.0050.01015.73
7.1.190.0040.00715.86
7.1.180.0050.00615.86
7.1.170.0050.00515.85
7.1.160.0030.01115.88
7.1.150.0060.00815.78
7.1.140.0060.00615.67
7.1.130.0070.00615.73
7.1.120.0050.00915.73
7.1.110.0030.00815.85
7.1.100.0070.00716.38
7.1.90.0060.00515.78
7.1.80.0030.01115.83
7.1.70.0060.00716.29
7.1.60.0070.01016.91
7.1.50.0060.01016.19
7.1.40.0030.01315.58
7.1.30.0050.00715.70
7.1.20.0030.01015.71
7.1.10.0050.00815.71
7.1.00.0020.01617.92
7.0.330.0080.00715.41
7.0.320.0060.00615.35
7.0.310.0050.00715.40
7.0.300.0030.01115.37
7.0.290.0070.00715.30
7.0.280.0050.01015.29
7.0.270.0070.00315.34
7.0.260.0030.00715.45
7.0.250.0030.00515.32
7.0.240.0100.00315.46
7.0.230.0050.00615.42
7.0.220.0060.00515.29
7.0.210.0040.00415.37
7.0.200.0030.01015.68
7.0.190.0050.01015.43
7.0.180.0080.00915.33
7.0.170.0060.00515.36
7.0.160.0100.00315.46
7.0.150.0040.00815.22
7.0.140.0070.02817.59
7.0.130.0020.00915.36
7.0.120.0030.01015.31
7.0.110.0020.00915.20
7.0.100.0070.00515.32
7.0.90.0070.00515.40
7.0.80.0030.01015.51
7.0.70.0040.00715.47
7.0.60.0030.03416.86
7.0.50.0090.03116.22
7.0.40.0070.03115.65
7.0.30.0150.02815.67
7.0.20.0120.01615.57
7.0.10.0100.03115.77
7.0.00.0060.02015.75
5.6.400.0070.00914.74
5.6.390.0060.00514.26
5.6.380.0070.00414.15
5.6.370.0080.00614.56
5.6.360.0090.00514.46
5.6.350.0060.00814.69
5.6.340.0050.00914.39
5.6.330.0030.00914.55
5.6.320.0080.00614.32
5.6.310.0110.00414.45
5.6.300.0020.01314.44
5.6.290.0090.00414.36
5.6.280.0030.03216.59
5.6.270.0040.00914.39
5.6.260.0080.00314.36
5.6.250.0060.00614.58
5.6.240.0060.00414.41
5.6.230.0030.01114.31
5.6.220.0000.01314.30
5.6.210.0040.02516.48
5.6.200.0040.03915.56
5.6.190.0050.03416.49
5.6.180.0140.03016.49
5.6.170.0090.02516.45
5.6.160.0090.03316.57
5.6.150.0060.02615.61
5.6.140.0070.03115.76
5.6.130.0030.03415.59
5.6.120.0040.01816.66
5.6.110.0050.02416.56
5.6.100.0060.03316.66
5.6.90.0060.03316.55
5.6.80.0020.03616.36
5.6.70.0150.02716.43
5.6.60.0040.01114.42
5.6.50.0020.00814.29
5.6.40.0060.00614.37
5.6.30.0110.00514.27
5.6.20.0050.00914.52
5.6.10.0030.01114.42
5.6.00.0050.00814.28
5.5.380.0000.01114.44
5.5.370.0030.01014.58
5.5.360.0080.00314.39
5.5.350.0040.03416.54
5.5.340.0050.01615.71
5.5.330.0060.03316.22
5.5.320.0060.02316.40
5.5.310.0080.01916.47
5.5.300.0040.02115.40
5.5.290.0080.02215.56
5.5.280.0020.02916.43
5.5.270.0030.01916.65
5.5.260.0080.03316.59
5.5.250.0080.03116.52
5.5.240.0080.02716.24
5.5.230.0110.00514.22
5.5.220.0080.00614.11
5.5.210.0060.00614.23
5.5.200.0020.00814.40
5.5.190.0080.00414.48
5.5.180.0060.00914.25
5.5.170.0050.00914.27
5.5.160.0080.00814.42
5.5.150.0040.00614.28
5.5.140.0070.00514.45
5.5.130.0080.00614.30
5.5.120.0050.00714.31
5.5.110.0050.00814.40
5.5.100.0050.00614.21
5.5.90.0020.01014.26
5.5.80.0060.00714.24
5.5.70.0070.00714.17
5.5.60.0070.00414.32
5.5.50.0030.01114.34
5.5.40.0050.01014.30
5.5.30.0080.00814.42
5.5.20.0060.00914.25
5.5.10.0030.01014.28
5.5.00.0040.00714.09
5.4.450.0300.02114.23
5.4.440.0300.02514.20
5.4.430.0240.03414.30
5.4.420.0340.02014.31
5.4.410.0340.02414.29
5.4.400.0100.02314.07
5.4.390.0160.02214.07
5.4.380.0110.02113.98
5.4.370.0070.02114.02
5.4.360.0080.02014.05
5.4.350.0040.02111.84
5.4.340.0080.01611.84
5.4.330.0070.00511.67
5.4.320.0060.01612.01
5.4.310.0030.02211.94
5.4.300.0070.01811.97
5.4.290.0040.02011.96
5.4.280.0040.01511.89
5.4.270.0010.02311.85
5.4.260.0050.01611.87
5.4.250.0130.02014.13
5.4.240.0110.01714.07
5.4.230.0010.02514.12
5.4.220.0080.02514.09
5.4.210.0060.02214.00
5.4.200.0100.02214.02
5.4.190.0090.01914.10
5.4.180.0060.02114.06
5.4.170.0050.02413.94
5.4.160.0060.01914.00
5.4.150.0090.02214.01
5.4.140.0040.02213.25
5.4.130.0060.02413.20
5.4.120.0040.02113.31
5.4.110.0040.02413.37
5.4.100.0070.02413.23
5.4.90.0050.02013.25
5.4.80.0070.02013.25
5.4.70.0050.02113.29
5.4.60.0040.01913.24
5.4.50.0100.02013.28
5.4.40.0090.02513.20
5.4.30.0080.01713.28
5.4.20.0070.02113.18
5.4.10.0070.02313.27
5.4.00.0090.02313.06
5.3.290.0040.02511.92
5.3.280.0050.02512.51
5.3.270.0050.02412.54
5.3.260.0070.02012.55
5.3.250.0030.02312.46
5.3.240.0050.02212.54
5.3.230.0050.02212.43
5.3.220.0090.02312.38
5.3.210.0070.01912.45
5.3.200.0060.02212.50
5.3.190.0090.02512.40
5.3.180.0040.02212.52
5.3.170.0060.02412.45
5.3.160.0040.02212.50
5.3.150.0070.02512.47
5.3.140.0050.01912.48
5.3.130.0090.02312.49
5.3.120.0060.02212.47
5.3.110.0060.02212.47
5.3.100.0070.02812.29
5.3.90.0060.03012.39
5.3.80.0040.02412.17
5.3.70.0070.02112.22
5.3.60.0050.02812.27
5.3.50.0090.02312.28
5.3.40.0070.02012.26
5.3.30.0090.02712.25
5.3.20.0060.02312.16
5.3.10.0050.02112.15
5.3.00.0050.02012.16
5.2.170.0070.06311.35
5.2.160.0100.04011.24
5.2.150.0130.05311.14
5.2.140.0130.04011.14
5.2.130.0070.04011.18
5.2.120.0130.05010.95
5.2.110.0130.03310.93
5.2.100.0070.05710.93
5.2.90.0100.03711.11
5.2.80.0130.03711.08
5.2.70.0030.05311.07
5.2.60.0000.04710.89
5.2.50.0070.03710.87
5.2.40.0070.05010.98
5.2.30.0130.03310.95
5.2.20.0100.04010.96
5.2.10.0130.03310.84
5.2.00.0130.05310.73
5.1.60.0070.03710.24
5.1.50.0070.04710.24
5.1.40.0070.03310.24
5.1.30.0030.03710.31
5.1.20.0100.04710.58
5.1.10.0070.03310.24
5.1.00.0000.04710.32
5.0.50.0070.02710.24
5.0.40.0100.02010.24
5.0.30.0070.04010.24
5.0.20.0000.03310.24
5.0.10.0000.04010.24
5.0.00.0030.05710.24
4.4.90.0100.01710.24
4.4.80.0070.02010.24
4.4.70.0000.02710.24
4.4.60.0100.02310.24
4.4.50.0030.02710.24
4.4.40.0000.03710.24
4.4.30.0030.02310.24
4.4.20.0030.02010.24
4.4.10.0100.01710.24
4.4.00.0070.04010.24
4.3.110.0070.02710.24
4.3.100.0000.02310.24
4.3.90.0030.03010.24
4.3.80.0170.03010.24
4.3.70.0030.03010.24
4.3.60.0030.02310.24
4.3.50.0000.03010.24
4.3.40.0130.02710.24
4.3.30.0000.03010.24
4.3.20.0030.02010.24
4.3.10.0100.01310.24
4.3.00.0070.0305.87

preferences:
81.74 ms | 401 KiB | 5 Q