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 foo implements ArrayAccess { private $bar = array('a', 'b', 'callback', 'time', 'c', 'secret', 'whatever'); public function offsetExists ( $offset ) { return true; } public function offsetGet ( $offset ) { return next($this->bar); } public function offsetSet ( $offset, $value ) { } public function offsetUnset ( $offset ) { } public function __invoke() { return next($this->bar); } } $tree = new foo(); $test->hack = $tree; $test->hack = $tree; // 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.00718.38
8.3.50.0080.01021.27
8.3.40.0110.00418.66
8.3.30.0180.00019.15
8.3.20.0040.00420.34
8.3.10.0080.00021.95
8.3.00.0030.00522.51
8.2.180.0190.00016.88
8.2.170.0050.01022.96
8.2.160.0090.00619.38
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0050.00226.16
8.2.120.0000.00819.89
8.2.110.0030.00622.26
8.2.100.0120.00017.91
8.2.90.0030.00619.76
8.2.80.0000.00817.97
8.2.70.0060.00317.75
8.2.60.0030.00717.93
8.2.50.0040.00818.07
8.2.40.0030.00618.32
8.2.30.0000.00718.23
8.2.20.0070.00017.77
8.2.10.0040.00417.83
8.2.00.0080.00017.69
8.1.280.0070.00725.92
8.1.270.0090.00018.63
8.1.260.0030.00526.35
8.1.250.0030.00528.09
8.1.240.0060.00322.41
8.1.230.0040.00720.95
8.1.220.0060.00317.79
8.1.210.0030.00519.04
8.1.200.0030.00617.47
8.1.190.0050.00317.65
8.1.180.0030.00618.74
8.1.170.0040.00418.51
8.1.160.0030.00322.23
8.1.150.0040.00418.76
8.1.140.0040.00417.50
8.1.130.0030.00317.86
8.1.120.0040.00417.43
8.1.110.0040.00417.48
8.1.100.0070.00017.40
8.1.90.0060.00617.51
8.1.80.0030.00517.40
8.1.70.0020.00517.45
8.1.60.0000.00817.61
8.1.50.0040.00417.45
8.1.40.0040.00417.47
8.1.30.0020.00517.70
8.1.20.0050.00317.69
8.1.10.0000.00817.59
8.1.00.0080.00017.40
8.0.300.0070.00020.10
8.0.290.0000.00717.05
8.0.280.0070.00018.51
8.0.270.0000.00717.30
8.0.260.0000.00718.44
8.0.250.0000.00717.02
8.0.240.0030.00517.03
8.0.230.0040.00417.01
8.0.220.0030.00316.91
8.0.210.0000.00716.79
8.0.200.0030.00317.04
8.0.190.0000.00716.94
8.0.180.0050.00216.88
8.0.170.0040.00416.80
8.0.160.0040.00416.91
8.0.150.0040.00416.93
8.0.140.0030.00516.90
8.0.130.0000.00613.26
8.0.120.0000.00816.91
8.0.110.0000.00716.85
8.0.100.0070.00016.96
8.0.90.0030.00516.94
8.0.80.0100.00716.93
8.0.70.0000.00816.75
8.0.60.0000.00816.92
8.0.50.0070.00016.79
8.0.30.0110.00817.24
8.0.20.0130.00717.40
8.0.10.0030.00517.00
8.0.00.0110.00716.74
7.4.330.0050.00015.09
7.4.320.0030.00316.52
7.4.300.0060.00016.52
7.4.290.0000.00816.55
7.4.280.0000.00816.45
7.4.270.0040.00416.55
7.4.260.0040.00416.54
7.4.250.0050.00216.59
7.4.240.0020.00516.65
7.4.230.0070.00016.63
7.4.220.0090.00916.61
7.4.210.0060.00816.62
7.4.200.0000.00816.64
7.4.190.0050.00216.50
7.4.160.0030.01316.37
7.4.150.0080.00817.40
7.4.140.0090.00717.86
7.4.130.0070.01016.48
7.4.120.0120.00516.54
7.4.110.0090.00916.43
7.4.100.0070.01016.47
7.4.90.0090.00916.55
7.4.80.0150.00619.39
7.4.70.0150.00316.40
7.4.60.0110.00716.43
7.4.50.0040.00416.49
7.4.40.0030.01222.77
7.4.30.0030.01316.60
7.4.00.0030.01014.93
7.3.330.0050.00013.41
7.3.320.0030.00313.40
7.3.310.0000.00716.38
7.3.300.0000.00716.30
7.3.290.0130.00916.41
7.3.280.0060.01116.37
7.3.270.0130.00317.40
7.3.260.0130.00316.51
7.3.250.0130.00416.48
7.3.240.0110.01016.22
7.3.230.0070.01016.52
7.3.210.0090.00916.70
7.3.200.0110.00719.39
7.3.190.0060.01316.41
7.3.180.0070.01016.49
7.3.170.0070.01016.37
7.3.160.0120.00316.46
7.3.120.0070.00714.92
7.3.110.0030.00914.90
7.3.100.0060.00614.62
7.3.90.0040.01214.66
7.3.80.0080.00414.84
7.3.70.0020.01314.92
7.3.60.0100.00314.91
7.3.50.0100.00714.99
7.3.40.0030.00914.55
7.3.30.0030.01014.84
7.3.20.0130.00716.74
7.3.10.0050.01016.53
7.3.00.0110.00816.55
7.2.330.0090.00916.88
7.2.320.0070.01016.85
7.2.310.0150.01016.79
7.2.300.0120.00916.83
7.2.290.0110.00616.77
7.2.240.0050.00315.21
7.2.230.0120.00315.21
7.2.220.0040.00815.23
7.2.210.0080.00815.13
7.2.200.0000.01414.98
7.2.190.0090.00615.02
7.2.180.0030.00915.15
7.2.170.0070.01115.19
7.2.160.0030.00914.86
7.2.150.0040.00816.52
7.2.140.0080.01117.02
7.2.130.0110.00416.63
7.2.120.0090.00616.67
7.2.110.0100.00916.48
7.2.100.0100.00316.53
7.2.90.0080.00816.75
7.2.80.0090.00916.76
7.2.70.0110.00516.82
7.2.60.0080.01116.56
7.2.50.0080.00816.69
7.2.40.0080.00616.56
7.2.30.0070.00816.85
7.2.20.0070.00916.75
7.2.10.0080.00616.91
7.2.00.0090.00417.60
7.1.330.0080.00815.77
7.1.320.0000.01516.00
7.1.310.0060.00615.87
7.1.300.0070.00715.87
7.1.290.0060.00815.87
7.1.280.0080.00615.52
7.1.270.0130.00015.60
7.1.260.0060.00615.75
7.1.250.0080.00815.57
7.1.100.0130.00718.27
7.1.70.0090.00617.06
7.1.60.0110.01519.82
7.1.50.0120.01216.78
7.1.00.0070.06022.35
7.0.200.0090.00016.63
7.0.140.0170.06021.90
7.0.70.3470.04319.86
7.0.60.0070.08320.11
7.0.50.0100.04317.91
7.0.40.0030.08020.09
7.0.30.0100.08320.25
7.0.20.0300.07320.15
7.0.10.0300.08020.21
7.0.00.0070.08020.22
5.6.280.0030.07021.13
5.6.210.0170.07320.55
5.6.200.0100.07718.29
5.6.190.0130.06320.38
5.6.180.0270.07720.46
5.6.170.0200.07320.48
5.6.160.0100.06720.46
5.6.150.0030.04018.25
5.6.140.0070.04318.14
5.6.130.0100.08018.15
5.6.120.0030.05720.90
5.6.110.0030.08721.09
5.6.100.0170.05321.12
5.6.90.0030.04020.89
5.6.80.0030.08320.39
5.6.70.0270.07020.53
5.5.350.0030.08020.46
5.5.340.0100.05718.07
5.5.330.0130.07720.13
5.5.320.0070.08020.21
5.5.310.0270.08020.36
5.5.300.0170.04717.99
5.5.290.0100.03317.95
5.5.280.0100.06720.88
5.5.270.0000.08020.77
5.5.260.0100.04720.74
5.5.250.0170.07720.67
5.5.240.0070.05320.23
5.4.450.0070.06719.30
5.4.440.1230.05719.45
5.4.430.0100.05719.47
5.4.420.0130.05319.58
5.4.410.0870.05319.25
5.4.400.0270.04719.26
5.4.390.0400.07019.12
5.4.380.0230.04718.61
5.4.370.0330.04718.50
5.4.360.0330.04718.51
5.4.350.0060.04012.03
5.4.340.0050.04612.02
5.4.320.0050.04012.51
5.4.310.0050.03912.50
5.4.300.0060.04912.51
5.4.290.0120.03612.50
5.4.280.0070.03512.40
5.4.270.0060.04312.40
5.4.260.0060.03812.40
5.4.250.0130.04718.79
5.4.240.0130.04718.95
5.4.230.0170.06318.98
5.4.220.0130.05018.74
5.4.210.0100.07318.93
5.4.200.0030.05719.09
5.4.190.0000.06018.89
5.4.180.0070.07018.94
5.4.170.0100.07018.93
5.4.160.0100.05018.73
5.4.150.0070.07318.94
5.4.140.0030.05316.39
5.4.130.0070.04716.58
5.4.120.0130.04316.32
5.4.110.0070.05016.47
5.4.100.0070.04716.46
5.4.90.0130.05016.42
5.4.80.0130.05316.49
5.4.70.0100.04716.61
5.4.60.0070.05316.52
5.4.50.0070.05016.39
5.4.40.0030.07016.43
5.4.30.0070.05316.62
5.4.20.0070.05016.53
5.4.10.0070.05316.38
5.4.00.0170.06315.88
5.3.290.0080.04412.80
5.3.280.0100.05014.44
5.3.270.0100.05314.79
5.3.260.0030.05714.71
5.3.250.0100.07314.78
5.3.240.0100.08314.79
5.3.230.0130.04714.79
5.3.220.0030.05314.76
5.3.210.0070.05314.48
5.3.200.0100.05314.50
5.3.190.0130.04714.71
5.3.180.0100.05014.64
5.3.170.0170.04314.48
5.3.160.0130.04714.48
5.3.150.0100.05314.66
5.3.140.0070.05714.63
5.3.130.0100.05314.46
5.3.120.0100.05014.58
5.3.110.0030.08014.57
5.3.100.0070.05014.14
5.3.90.0070.05014.03
5.3.80.0130.04314.10
5.3.70.0100.04714.20
5.3.60.0100.06014.03
5.3.50.0100.04713.95
5.3.40.0070.06314.14
5.3.30.0130.04714.09
5.3.20.0070.05713.68
5.3.10.0100.05013.57
5.3.00.0100.04713.84
5.2.170.0070.04011.15
5.2.160.0070.05311.39
5.2.150.0000.05311.24
5.2.140.0170.04711.00
5.2.130.0130.03311.19
5.2.120.0170.03711.21
5.2.110.0030.05311.29
5.2.100.0030.04311.20
5.2.90.0000.05311.20
5.2.80.0030.04711.20
5.2.70.0100.03711.33
5.2.60.0030.04311.15
5.2.50.0070.04011.13
5.2.40.0030.05311.23
5.2.30.0100.05711.08
5.2.20.0000.04711.14
5.2.10.0130.03710.83
5.2.00.0130.03310.73
5.1.60.0130.0339.95
5.1.50.0170.02310.05
5.1.40.0030.0339.91
5.1.30.0100.05010.33
5.1.20.0100.04010.46
5.1.10.0070.04310.05
5.1.00.0070.04010.16
5.0.50.0030.0308.66
5.0.40.0070.0378.43
5.0.30.0070.0408.29
5.0.20.0170.0238.30
5.0.10.0100.0278.18
5.0.00.0100.0538.18
4.4.90.0030.0237.83
4.4.80.0070.0277.83
4.4.70.0000.0237.83
4.4.60.0100.0207.83
4.4.50.0070.0177.83
4.4.40.0070.0407.83
4.4.30.0030.0237.83
4.4.20.0100.0177.83
4.4.10.0000.0237.83
4.4.00.0170.0337.83
4.3.110.0000.0237.83
4.3.100.0030.0207.83
4.3.90.0030.0277.83
4.3.80.0000.0377.83
4.3.70.0030.0307.83
4.3.60.0030.0207.83
4.3.50.0070.0177.83
4.3.40.0030.0437.83
4.3.30.0030.0207.83
4.3.20.0030.0237.83
4.3.10.0030.0237.83
4.3.00.0070.0237.52

preferences:
49.88 ms | 401 KiB | 5 Q