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($v);die; var_dump($v());die; $value = $v(); // and a callback! $this->{$key} = $value; } } $test = new Test; // start editing here class A implements ArrayAccess { private $callCount = 0; public function __invoke($name, $args){ echo "WOOO";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.70.0060.00916.88
8.3.60.0070.01118.56
8.3.50.0110.00821.20
8.3.40.0070.00718.91
8.3.30.0030.01020.38
8.3.20.0070.00020.29
8.3.10.0000.00821.92
8.3.00.0040.00422.33
8.2.180.0090.00618.36
8.2.170.0070.00722.96
8.2.160.0080.00820.44
8.2.150.0060.00324.18
8.2.140.0090.00024.66
8.2.130.0040.01426.16
8.2.120.0050.00319.77
8.2.110.0030.00622.31
8.2.100.0110.00019.38
8.2.90.0090.00019.21
8.2.80.0040.00419.30
8.2.70.0040.00417.62
8.2.60.0040.00418.03
8.2.50.0040.00418.07
8.2.40.0040.00418.28
8.2.30.0070.00018.22
8.2.20.0000.00717.68
8.2.10.0080.00017.71
8.2.00.0050.00317.84
8.1.280.0090.00925.92
8.1.270.0060.00324.66
8.1.260.0050.00226.35
8.1.250.0040.00428.09
8.1.240.0090.00023.84
8.1.230.0040.00719.14
8.1.220.0000.00917.78
8.1.210.0040.00418.77
8.1.200.0090.00017.47
8.1.190.0030.00617.52
8.1.180.0040.00420.25
8.1.170.0040.00418.41
8.1.160.0040.00422.04
8.1.150.0070.00018.57
8.1.140.0080.00017.51
8.1.130.0060.00317.83
8.1.120.0050.00317.52
8.1.110.0000.00717.47
8.1.100.0070.00017.41
8.1.90.0040.00417.53
8.1.80.0000.00817.44
8.1.70.0030.00317.37
8.1.60.0000.00917.52
8.1.50.0040.00417.46
8.1.40.0030.00617.56
8.1.30.0000.00817.56
8.1.20.0060.00317.62
8.1.10.0030.00617.58
8.1.00.0090.00017.54
8.0.300.0030.00318.77
8.0.290.0000.00717.15
8.0.280.0030.00318.34
8.0.270.0000.00717.18
8.0.260.0030.00316.78
8.0.250.0030.00317.04
8.0.240.0040.00716.94
8.0.230.0030.00317.02
8.0.220.0040.00416.86
8.0.210.0070.00017.00
8.0.200.0030.00317.04
8.0.190.0040.00417.01
8.0.180.0000.00717.02
8.0.170.0050.00216.91
8.0.160.0050.00216.93
8.0.150.0040.00416.95
8.0.140.0070.00016.95
8.0.130.0030.00313.39
8.0.120.0040.00416.92
8.0.110.0050.00217.02
8.0.100.0040.00416.92
8.0.90.0050.00216.97
8.0.80.0100.00516.96
8.0.70.0040.00417.00
8.0.60.0040.00416.94
8.0.50.0040.00416.86
8.0.30.0060.01317.07
8.0.20.0090.01017.40
8.0.10.0050.00316.97
8.0.00.0080.01116.86
7.4.330.0050.00015.00
7.4.320.0060.00016.46
7.4.300.0000.00716.67
7.4.290.0040.00416.50
7.4.280.0050.00316.59
7.4.270.0000.00716.64
7.4.260.0030.00316.53
7.4.250.0030.00516.59
7.4.240.0010.00616.47
7.4.230.0070.00016.72
7.4.220.0060.00916.51
7.4.210.0070.00716.64
7.4.200.0000.00716.61
7.4.190.0030.00316.63
7.4.160.0080.00816.62
7.4.150.0130.00417.40
7.4.140.0070.01117.86
7.4.130.0080.00816.65
7.4.120.0040.01316.56
7.4.110.0060.01216.45
7.4.100.0180.00016.67
7.4.90.0150.00316.45
7.4.80.0070.01019.39
7.4.70.0170.00416.75
7.4.60.0030.01316.70
7.4.50.0000.00516.45
7.4.40.0070.01122.77
7.4.30.0070.01716.54
7.4.10.0050.01214.81
7.4.00.0060.01215.05
7.3.330.0030.00313.31
7.3.320.0030.00213.36
7.3.310.0000.00716.28
7.3.300.0000.00716.39
7.3.290.0090.00916.40
7.3.280.0070.00816.42
7.3.270.0100.00717.40
7.3.260.0000.01716.44
7.3.250.0080.01116.49
7.3.240.0080.00816.38
7.3.230.0120.00616.54
7.3.210.0110.00716.50
7.3.200.0060.01519.39
7.3.190.0130.00616.50
7.3.180.0090.00616.52
7.3.170.0130.00316.38
7.3.160.0170.00016.57
7.3.130.0090.00814.88
7.3.120.0090.00714.93
7.3.110.0100.01014.95
7.3.100.0060.00714.84
7.3.90.0080.00714.83
7.3.80.0080.00614.60
7.3.70.0060.00914.85
7.3.60.0050.01114.92
7.3.50.0060.00514.98
7.3.40.0070.00814.93
7.3.30.0030.01014.81
7.3.20.0070.00716.80
7.3.10.0110.00416.44
7.3.00.0070.00816.55
7.2.330.0090.00916.71
7.2.320.0110.00716.85
7.2.310.0060.01316.77
7.2.300.0080.00816.50
7.2.290.0140.00416.48
7.2.260.0050.01115.08
7.2.250.0030.01515.35
7.2.240.0100.00515.17
7.2.230.0090.00715.26
7.2.220.0080.00815.30
7.2.210.0090.00715.00
7.2.200.0030.01415.06
7.2.190.0060.00815.18
7.2.180.0060.00715.13
7.2.170.0100.00315.02
7.2.160.0060.00814.97
7.2.150.0020.01016.76
7.2.140.0020.01016.98
7.2.130.0060.01016.90
7.2.120.0100.00616.94
7.2.110.0070.00816.87
7.2.100.0070.01016.93
7.2.90.0040.00916.79
7.2.80.0060.00817.01
7.2.70.0080.00916.92
7.2.60.0100.00716.80
7.2.50.0080.00916.91
7.2.40.0120.00517.08
7.2.30.0090.00716.84
7.2.20.0080.00917.07
7.2.10.0070.00916.63
7.2.00.0080.00917.45
7.1.330.0050.00716.01
7.1.320.0090.00315.80
7.1.310.0040.01015.75
7.1.300.0050.01015.74
7.1.290.0060.00715.68
7.1.280.0060.00915.88
7.1.270.0060.01215.76
7.1.260.0050.00815.80
7.1.250.0050.00715.64
7.1.240.0080.00315.83
7.1.230.0110.00415.82
7.1.220.0020.01015.78
7.1.210.0070.00515.63
7.1.200.0070.00515.81
7.1.190.0020.01115.64
7.1.180.0050.01015.80
7.1.170.0060.00915.88
7.1.160.0050.00815.66
7.1.150.0050.00515.85
7.1.140.0090.00315.64
7.1.130.0050.00915.81
7.1.120.0030.00715.85
7.1.110.0070.00715.76
7.1.100.0050.00716.44
7.1.90.0060.00815.85
7.1.80.0070.00515.85
7.1.70.0050.00816.16
7.1.60.0060.01116.88
7.1.50.0100.00716.12
7.1.40.0050.00915.84
7.1.30.0070.00615.57
7.1.20.0010.01315.81
7.1.10.0050.00815.66
7.1.00.0050.01417.97
7.0.330.0050.00715.23
7.0.320.0080.00715.34
7.0.310.0120.00315.34
7.0.300.0040.00815.26
7.0.290.0070.00715.17
7.0.280.0030.00815.35
7.0.270.0090.00615.37
7.0.260.0020.01115.21
7.0.250.0050.01115.43
7.0.240.0050.00915.46
7.0.230.0090.00315.42
7.0.220.0050.00615.45
7.0.210.0080.00615.39
7.0.200.0090.00515.19
7.0.190.0060.00415.22
7.0.180.0020.00915.29
7.0.170.0080.00715.48
7.0.160.0070.00915.38
7.0.150.0080.00515.40
7.0.140.0060.02817.60
7.0.130.0020.00915.36
7.0.120.0070.00515.37
7.0.110.0060.01015.36
7.0.100.0110.00315.32
7.0.90.0060.00515.43
7.0.80.0020.00815.32
7.0.70.0020.01315.45
7.0.60.0070.03116.95
7.0.50.0050.02416.25
7.0.40.0070.01915.66
7.0.30.0140.03115.70
7.0.20.0150.03215.76
7.0.10.0130.02815.58
7.0.00.0050.01815.74
5.6.400.0040.01114.26
5.6.390.0050.00814.78
5.6.380.0020.01314.52
5.6.370.0060.00614.50
5.6.360.0070.00614.62
5.6.350.0020.01114.35
5.6.340.0060.00614.48
5.6.330.0080.00814.48
5.6.320.0050.01114.57
5.6.310.0070.00714.30
5.6.300.0050.00714.54
5.6.290.0090.00414.63
5.6.280.0030.03116.64
5.6.270.0040.01014.46
5.6.260.0030.01114.36
5.6.250.0020.01114.48
5.6.240.0030.00914.41
5.6.230.0030.01014.39
5.6.220.0050.00714.53
5.6.210.0060.01916.43
5.6.200.0010.02315.67
5.6.190.0030.03716.44
5.6.180.0120.02616.48
5.6.170.0090.02316.51
5.6.160.0070.03316.40
5.6.150.0030.02115.70
5.6.140.0080.02115.71
5.6.130.0060.03215.74
5.6.120.0140.02716.69
5.6.110.0060.03116.73
5.6.100.0050.02716.72
5.6.90.0050.01816.61
5.6.80.0040.03116.40
5.6.70.0160.02416.33
5.6.60.0080.00814.44
5.6.50.0030.00814.24
5.6.40.0070.00914.41
5.6.30.0030.01314.31
5.6.20.0020.01314.38
5.6.10.0070.00714.52
5.6.00.0050.00814.48
5.5.380.0040.00914.41
5.5.370.0090.00714.42
5.5.360.0050.00414.52
5.5.350.0070.01816.45
5.5.340.0050.02415.51
5.5.330.0080.02416.43
5.5.320.0120.01816.45
5.5.310.0170.01316.30
5.5.300.0030.03415.53
5.5.290.0040.02015.64
5.5.280.0090.02116.38
5.5.270.0040.03816.67
5.5.260.0050.03416.64
5.5.250.0090.02616.29
5.5.240.0080.02616.25
5.5.230.0040.01214.51
5.5.220.0090.00514.36
5.5.210.0090.00314.40
5.5.200.0070.00914.46
5.5.190.0070.00514.36
5.5.180.0060.00514.44
5.5.170.0060.00814.18
5.5.160.0090.00914.28
5.5.150.0080.00314.29
5.5.140.0090.00514.30
5.5.130.0030.01114.47
5.5.120.0060.00914.35
5.5.110.0100.00514.45
5.5.100.0020.01013.98
5.5.90.0040.00714.43
5.5.80.0050.01014.41
5.5.70.0060.00714.23
5.5.60.0020.01514.39
5.5.50.0040.00714.45
5.5.40.0020.01314.24
5.5.30.0020.00914.40
5.5.20.0050.00714.34
5.5.10.0060.00614.36
5.5.00.0090.00513.95
5.4.450.0070.02714.15
5.4.440.0050.03013.97
5.4.430.0070.02614.11
5.4.420.0040.03114.22
5.4.410.0080.02613.87
5.4.400.0070.02913.98
5.4.390.0040.03114.04
5.4.380.0030.03013.87
5.4.370.0060.01614.04
5.4.360.0060.02913.97
5.4.350.0040.02813.93
5.4.340.0070.02813.84
5.4.330.0050.00711.45
5.4.320.0050.02313.94
5.4.310.0020.03013.97
5.4.300.0040.02114.06
5.4.290.0060.01714.05
5.4.280.0090.02613.97
5.4.270.0050.01713.96
5.4.260.0080.01414.04
5.4.250.0040.02913.98
5.4.240.0050.02713.95
5.4.230.0070.02313.95
5.4.220.0060.02713.88
5.4.210.0030.03014.02
5.4.200.0040.02514.06
5.4.190.0040.01813.94
5.4.180.0040.02713.96
5.4.170.0050.02913.93
5.4.160.0060.03113.90
5.4.150.0030.03013.90
5.4.140.0070.02413.07
5.4.130.0030.03013.04
5.4.120.0040.02413.05
5.4.110.0060.01813.04
5.4.100.0040.02513.10
5.4.90.0010.03013.08
5.4.80.0030.02313.11
5.4.70.0010.03013.07
5.4.60.0030.02513.08
5.4.50.0050.02313.03
5.4.40.0050.02613.10
5.4.30.0060.01713.03
5.4.20.0060.02413.04
5.4.10.0040.02812.99
5.4.00.0080.02212.90
5.3.290.0050.01812.41
5.3.280.0040.03112.27
5.3.270.0050.02012.44
5.3.260.0060.02812.40
5.3.250.0060.02412.30
5.3.240.0040.02912.30
5.3.230.0030.02912.30
5.3.220.0020.03312.24
5.3.210.0050.02312.30
5.3.200.0020.03012.37
5.3.190.0040.02812.33
5.3.180.0030.03112.37
5.3.170.0030.02212.36
5.3.160.0030.02812.26
5.3.150.0070.02112.37
5.3.140.0050.03012.33
5.3.130.0030.03112.30
5.3.120.0060.02112.29
5.3.110.0040.02812.32
5.3.100.0060.02212.05
5.3.90.0040.02512.10
5.3.80.0040.02512.06
5.3.70.0030.02912.15
5.3.60.0020.02912.18
5.3.50.0050.02212.05
5.3.40.0010.03012.17
5.3.30.0030.03112.07
5.3.20.0060.02612.03
5.3.10.0020.02511.96
5.3.00.0050.02711.92
5.2.170.0030.05713.79
5.2.160.0030.03713.79
5.2.150.0070.06013.79
5.2.140.0000.05713.79
5.2.130.0070.05713.79
5.2.120.0030.06013.79
5.2.110.0030.05313.79
5.2.100.0100.05713.79
5.2.90.0030.04313.79
5.2.80.0000.05013.79
5.2.70.0030.06313.79
5.2.60.0030.03713.79
5.2.50.0070.04313.79
5.2.40.0000.04713.79
5.2.30.0100.04313.79
5.2.20.0000.06013.79
5.2.10.0070.05713.79
5.2.00.0070.05313.79
5.1.60.0070.03713.79
5.1.50.0030.05013.79
5.1.40.0000.04713.79
5.1.30.0000.06313.79
5.1.20.0030.05713.79
5.1.10.0000.06013.79
5.1.00.0030.03713.79
5.0.50.0030.02713.79
5.0.40.0000.02013.79
5.0.30.0000.04013.79
5.0.20.0000.02013.79
5.0.10.0030.02013.79
5.0.00.0000.03013.79
4.4.90.0030.01713.79
4.4.80.0000.02713.79
4.4.70.0000.03013.79
4.4.60.0000.03013.79
4.4.50.0000.03313.79
4.4.40.0030.04013.79
4.4.30.0000.01713.79
4.4.20.0000.02713.79
4.4.10.0000.02013.79
4.4.00.0000.03013.79
4.3.110.0000.01713.79
4.3.100.0000.01313.79
4.3.90.0070.01313.79
4.3.80.0000.02313.79
4.3.70.0030.01313.79
4.3.60.0000.02013.79
4.3.50.0000.01713.79
4.3.40.0000.02313.79
4.3.30.0000.02013.79
4.3.20.0070.01013.79
4.3.10.0000.01713.79
4.3.00.0030.01013.79

preferences:
43.97 ms | 401 KiB | 5 Q