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 __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) { if ($this->callCount == 0){ return $this; } else { return "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.60.0130.00718.55
8.3.50.0120.00521.27
8.3.40.0090.00618.82
8.3.30.0140.00020.17
8.3.20.0040.00420.16
8.3.10.0030.00522.09
8.3.00.0070.00422.44
8.2.180.0140.00716.63
8.2.170.0110.00422.96
8.2.160.0090.00620.25
8.2.150.0080.00024.18
8.2.140.0080.00824.66
8.2.130.0050.00326.16
8.2.120.0100.00719.66
8.2.110.0050.00522.24
8.2.100.0060.00619.46
8.2.90.0030.00619.22
8.2.80.0030.00619.47
8.2.70.0040.00417.63
8.2.60.0040.00417.80
8.2.50.0040.00418.07
8.2.40.0000.00818.16
8.2.30.0000.00718.09
8.2.20.0000.00717.78
8.2.10.0040.00417.76
8.2.00.0040.00417.75
8.1.280.0100.00325.92
8.1.270.0000.00824.66
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00623.69
8.1.230.0110.00019.04
8.1.220.0040.00417.79
8.1.210.0000.00818.77
8.1.200.0030.00617.35
8.1.190.0040.00417.54
8.1.180.0040.00420.25
8.1.170.0000.00818.52
8.1.160.0000.00822.27
8.1.150.0040.00418.53
8.1.140.0030.00617.38
8.1.130.0030.00717.89
8.1.120.0040.00417.48
8.1.110.0050.00317.51
8.1.100.0040.00417.52
8.1.90.0000.00817.38
8.1.80.0000.00717.34
8.1.70.0030.00317.38
8.1.60.0050.00517.59
8.1.50.0040.00417.42
8.1.40.0080.00017.52
8.1.30.0040.00417.65
8.1.20.0040.00417.68
8.1.10.0030.00617.59
8.1.00.0080.00317.39
8.0.300.0040.00418.77
8.0.290.0030.00617.18
8.0.280.0060.00318.43
8.0.270.0030.00317.19
8.0.260.0050.00316.90
8.0.250.0030.00317.05
8.0.240.0020.00617.01
8.0.230.0030.00316.96
8.0.220.0030.00316.98
8.0.210.0000.00716.89
8.0.200.0000.00717.02
8.0.190.0030.00616.93
8.0.180.0030.00516.99
8.0.170.0030.00616.88
8.0.160.0030.00317.00
8.0.150.0000.00716.89
8.0.140.0050.00316.83
8.0.130.0000.00513.48
8.0.120.0040.00417.00
8.0.110.0020.00516.93
8.0.100.0040.00417.04
8.0.90.0070.00016.87
8.0.80.0090.00616.95
8.0.70.0040.00416.88
8.0.60.0000.00816.85
8.0.50.0080.00016.91
8.0.30.0120.01017.00
8.0.20.0050.01317.40
8.0.10.0000.00717.12
8.0.00.0110.01216.68
7.4.330.0000.00515.00
7.4.320.0040.00416.63
7.4.300.0030.00316.66
7.4.290.0000.00816.54
7.4.280.0070.00016.44
7.4.270.0000.00716.44
7.4.260.0030.00316.66
7.4.250.0070.00016.41
7.4.240.0000.00816.49
7.4.230.0040.00416.56
7.4.220.0060.01016.59
7.4.210.0070.00716.63
7.4.200.0000.00716.65
7.4.190.0030.00316.71
7.4.160.0100.00716.49
7.4.150.0130.00717.40
7.4.140.0090.01217.86
7.4.130.0060.01016.50
7.4.120.0120.00516.54
7.4.110.0070.01116.74
7.4.100.0070.01416.61
7.4.90.0160.00316.52
7.4.80.0090.01219.39
7.4.70.0140.00516.64
7.4.60.0060.01216.55
7.4.50.0090.00016.67
7.4.40.0080.00822.77
7.4.30.0140.00316.84
7.4.10.0070.01015.14
7.4.00.0070.01014.92
7.3.330.0050.00013.47
7.3.320.0050.00013.26
7.3.310.0070.00016.37
7.3.300.0060.00016.37
7.3.290.0060.00916.43
7.3.280.0110.00416.44
7.3.270.0160.00717.40
7.3.260.0060.01116.56
7.3.250.0030.01416.35
7.3.240.0040.01416.56
7.3.230.0160.00316.45
7.3.210.0100.00716.44
7.3.200.0070.01019.39
7.3.190.0120.00616.45
7.3.180.0130.00416.45
7.3.170.0150.01016.63
7.3.160.0060.01016.45
7.3.130.0040.01214.90
7.3.120.0080.01014.85
7.3.110.0060.01214.81
7.3.100.0020.01114.95
7.3.90.0050.01014.85
7.3.80.0070.00614.95
7.3.70.0050.00614.79
7.3.60.0100.00414.79
7.3.50.0070.00514.62
7.3.40.0040.00814.83
7.3.30.0060.00714.84
7.3.20.0070.00716.67
7.3.10.0040.01016.67
7.3.00.0090.00616.64
7.2.330.0140.00416.81
7.2.320.0060.01616.87
7.2.310.0100.00616.86
7.2.300.0130.00316.54
7.2.290.0130.00316.84
7.2.260.0090.01115.27
7.2.250.0040.01215.09
7.2.240.0060.00915.12
7.2.230.0060.00915.17
7.2.220.0050.01215.04
7.2.210.0060.01015.18
7.2.200.0060.00614.94
7.2.190.0050.01015.02
7.2.180.0060.00515.11
7.2.170.0060.00915.08
7.2.160.0050.01015.02
7.2.150.0080.00316.83
7.2.140.0050.00716.98
7.2.130.0050.01016.81
7.2.120.0050.00517.00
7.2.110.0030.01016.98
7.2.100.0050.01116.85
7.2.90.0070.00616.96
7.2.80.0080.00716.92
7.2.70.0060.01016.88
7.2.60.0050.00916.86
7.2.50.0080.00517.05
7.2.40.0070.00817.00
7.2.30.0050.00516.89
7.2.20.0010.01116.75
7.2.10.0080.00716.93
7.2.00.0070.00717.54
7.1.330.0050.00915.89
7.1.320.0060.00515.78
7.1.310.0050.00915.82
7.1.300.0040.01015.77
7.1.290.0030.00915.86
7.1.280.0050.00615.86
7.1.270.0070.00615.80
7.1.260.0040.00715.79
7.1.250.0050.00815.69
7.1.240.0090.00515.89
7.1.230.0040.00915.66
7.1.220.0080.00815.67
7.1.210.0050.00915.68
7.1.200.0050.00915.80
7.1.190.0040.01015.88
7.1.180.0040.00915.62
7.1.170.0090.00515.80
7.1.160.0060.00815.84
7.1.150.0080.00415.80
7.1.140.0060.00715.80
7.1.130.0050.00815.70
7.1.120.0060.00715.74
7.1.110.0110.00315.80
7.1.100.0050.00816.42
7.1.90.0040.01115.56
7.1.80.0010.01515.71
7.1.70.0050.00916.19
7.1.60.0080.00616.80
7.1.50.0080.00816.08
7.1.40.0090.00415.87
7.1.30.0070.00715.83
7.1.20.0090.00515.71
7.1.10.0040.00915.85
7.1.00.0070.02417.47
7.0.330.0050.00715.43
7.0.320.0030.01215.28
7.0.310.0060.00615.39
7.0.300.0040.00815.29
7.0.290.0060.00715.45
7.0.280.0080.00315.31
7.0.270.0050.00715.40
7.0.260.0040.01015.32
7.0.250.0060.00615.45
7.0.240.0040.01015.45
7.0.230.0070.00815.30
7.0.220.0040.01015.45
7.0.210.0080.00415.25
7.0.200.0070.00715.71
7.0.190.0060.00915.37
7.0.180.0040.00815.34
7.0.170.0050.00815.40
7.0.160.0030.00915.40
7.0.150.0020.01115.39
7.0.140.0050.02517.00
7.0.130.0020.00915.43
7.0.120.0040.00915.43
7.0.110.0030.00715.39
7.0.100.0070.02316.43
7.0.90.0060.02216.46
7.0.80.0100.02116.48
7.0.70.0040.02416.48
7.0.60.0040.01816.54
7.0.50.0070.01616.70
7.0.40.0040.02215.22
7.0.30.0060.01715.08
7.0.20.0050.02815.24
7.0.10.0070.02715.10
7.0.00.0060.02615.05
5.6.400.0040.00914.52
5.6.390.0040.00914.50
5.6.380.0080.00514.51
5.6.370.0040.00714.65
5.6.360.0080.00414.57
5.6.350.0040.01114.53
5.6.340.0020.00914.42
5.6.330.0110.00214.33
5.6.320.0030.00814.40
5.6.310.0060.00714.33
5.6.300.0090.00614.46
5.6.290.0060.00814.54
5.6.280.0040.02416.16
5.6.270.0070.00514.38
5.6.260.0070.00714.55
5.6.250.0080.01815.98
5.6.240.0060.01716.00
5.6.230.0050.02416.00
5.6.220.0040.01716.05
5.6.210.0060.01916.03
5.6.200.0040.02816.14
5.6.190.0070.02616.07
5.6.180.0070.01816.08
5.6.170.0050.02616.02
5.6.160.0080.02516.00
5.6.150.0060.02116.13
5.6.140.0060.02316.04
5.6.130.0020.02915.95
5.6.120.0070.02516.06
5.6.110.0090.01816.09
5.6.100.0070.01416.04
5.6.90.0060.02216.15
5.6.80.0060.02415.98
5.6.70.0070.01515.94
5.6.60.0110.02015.87
5.6.50.0010.02715.95
5.6.40.0070.01415.81
5.6.30.0050.02815.84
5.6.20.0070.02515.84
5.6.10.0070.02415.83
5.6.00.0090.02315.91
5.5.380.0050.02515.91
5.5.370.0050.02515.85
5.5.360.0060.01815.87
5.5.350.0040.01715.96
5.5.340.0070.02815.97
5.5.330.0060.02016.02
5.5.320.0030.02215.94
5.5.310.0050.02716.14
5.5.300.0080.02516.05
5.5.290.0080.02215.92
5.5.280.0050.03116.04
5.5.270.0070.02215.92
5.5.260.0040.01815.90
5.5.250.0090.02115.85
5.5.240.0070.02415.74
5.5.230.0060.01515.83
5.5.220.0050.01615.72
5.5.210.0070.02615.91
5.5.200.0060.02615.74
5.5.190.0070.02415.81
5.5.180.0080.02015.70
5.5.170.0080.00714.33
5.5.160.0050.01815.72
5.5.150.0050.02615.60
5.5.140.0070.01815.84
5.5.130.0070.02115.82
5.5.120.0050.02215.79
5.5.110.0040.01915.85
5.5.100.0070.02315.68
5.5.90.0050.01915.76
5.5.80.0090.02115.88
5.5.70.0060.02015.53
5.5.60.0080.02415.65
5.5.50.0040.01915.69
5.5.40.0050.01915.73
5.5.30.0040.02715.76
5.5.20.0030.02515.76
5.5.10.0080.01115.69
5.5.00.0070.02315.82
5.4.450.0030.02313.10
5.4.440.0050.02213.14
5.4.430.0040.02613.20
5.4.420.0040.02413.25
5.4.410.0040.02613.19
5.4.400.0030.01913.10
5.4.390.0070.02013.10
5.4.380.0040.01413.15
5.4.370.0050.01313.26
5.4.360.0050.02013.00
5.4.350.0070.02013.05
5.4.340.0060.02313.01
5.4.330.0030.00811.28
5.4.320.0030.01713.04
5.4.310.0030.02613.13
5.4.300.0040.02613.05
5.4.290.0030.01813.15
5.4.280.0070.01713.17
5.4.270.0040.02513.06
5.4.260.0070.02213.06
5.4.250.0040.02213.16
5.4.240.0050.02113.15
5.4.230.0060.01813.12
5.4.220.0070.01413.24
5.4.210.0070.02213.21
5.4.200.0070.02313.13
5.4.190.0080.01613.07
5.4.180.0050.01412.98
5.4.170.0040.01613.13
5.4.160.0050.01913.11
5.4.150.0070.02012.96
5.4.140.0060.02412.39
5.4.130.0050.02212.55
5.4.120.0070.02212.57
5.4.110.0040.02012.36
5.4.100.0020.02512.46
5.4.90.0050.02112.45
5.4.80.0050.01512.48
5.4.70.0050.02412.52
5.4.60.0090.01312.48
5.4.50.0050.02312.51
5.4.40.0100.02012.47
5.4.30.0080.02112.42
5.4.20.0050.02312.39
5.4.10.0040.02212.46
5.4.00.0100.01712.29
5.3.290.0040.02411.86
5.3.280.0040.02211.79
5.3.270.0050.02411.87
5.3.260.0050.02211.74
5.3.250.0060.02311.88
5.3.240.0080.02011.79
5.3.230.0040.02411.83
5.3.220.0050.02211.77
5.3.210.0050.02111.77
5.3.200.0020.02411.75
5.3.190.0050.01311.84
5.3.180.0060.02211.83
5.3.170.0070.02111.89
5.3.160.0060.02011.87
5.3.150.0030.01611.79
5.3.140.0050.02211.83
5.3.130.0050.02411.76
5.3.120.0030.02611.78
5.3.110.0060.02011.79
5.3.100.0070.02011.65
5.3.90.0050.01411.72
5.3.80.0050.02111.50
5.3.70.0060.02511.67
5.3.60.0060.01411.60
5.3.50.0070.01411.62
5.3.40.0070.02311.71
5.3.30.0060.02311.53
5.3.20.0060.01611.62
5.3.10.0030.01811.42
5.3.00.0050.02111.46
5.2.170.0070.06011.57
5.2.160.0030.06011.57
5.2.150.0100.05711.57
5.2.140.0030.03011.57
5.2.130.0100.02311.57
5.2.120.0030.03311.57
5.2.110.0100.05711.57
5.2.100.0030.03311.57
5.2.90.0000.06011.57
5.2.80.0000.04711.57
5.2.70.0100.04711.57
5.2.60.0070.06011.57
5.2.50.0030.03311.57
5.2.40.0000.04011.57
5.2.30.0100.04711.57
5.2.20.0030.05711.57
5.2.10.0100.04711.57
5.2.00.0070.04011.57
5.1.60.0030.04011.57
5.1.50.0030.04711.57
5.1.40.0030.04711.57
5.1.30.0100.04011.57
5.1.20.0000.03711.57
5.1.10.0000.03011.57
5.1.00.0070.04011.57
5.0.50.0100.03011.57
5.0.40.0000.03711.57
5.0.30.0000.03311.57
5.0.20.0100.01311.57
5.0.10.0070.04311.57
5.0.00.0070.05311.57
4.4.90.0000.03711.57
4.4.80.0000.03711.57
4.4.70.0070.03311.57
4.4.60.0030.03011.57
4.4.50.0000.03711.57
4.4.40.0070.04711.57
4.4.30.0070.02011.57
4.4.20.0000.02011.57
4.4.10.0000.03011.57
4.4.00.0070.03711.57
4.3.110.0030.01711.57
4.3.100.0000.03011.57
4.3.90.0000.01711.57
4.3.80.0030.04311.57
4.3.70.0000.02311.57
4.3.60.0030.03311.57
4.3.50.0030.02311.57
4.3.40.0000.02711.57
4.3.30.0070.03011.57
4.3.20.0000.03011.57
4.3.10.0030.01711.57
4.3.00.0070.03011.57

preferences:
42.52 ms | 401 KiB | 5 Q