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; // 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.0160.00018.68
8.3.50.0070.01621.27
8.3.40.0090.00618.90
8.3.30.0070.01319.05
8.3.20.0000.00820.22
8.3.10.0060.00321.99
8.3.00.0080.00022.58
8.2.180.0070.00716.88
8.2.170.0090.00922.96
8.2.160.0110.01120.45
8.2.150.0050.00324.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0040.00419.42
8.2.110.0060.00319.33
8.2.100.0080.00317.91
8.2.90.0000.00719.21
8.2.80.0000.00817.97
8.2.70.0050.00517.63
8.2.60.0070.00317.93
8.2.50.0080.00318.07
8.2.40.0080.00318.22
8.2.30.0080.00018.14
8.2.20.0040.00417.74
8.2.10.0080.00017.75
8.2.00.0040.00417.70
8.1.280.0070.01125.92
8.1.270.0060.00318.42
8.1.260.0020.00526.35
8.1.250.0040.00428.09
8.1.240.0150.00623.79
8.1.230.0040.00820.94
8.1.220.0000.00717.74
8.1.210.0040.00418.77
8.1.200.0090.00017.23
8.1.190.0000.00817.64
8.1.180.0030.00618.82
8.1.170.0060.00318.50
8.1.160.0030.00322.03
8.1.150.0030.00518.57
8.1.140.0040.00417.45
8.1.130.0030.00317.77
8.1.120.0040.00317.53
8.1.110.0000.00817.36
8.1.100.0040.00417.47
8.1.90.0050.00517.49
8.1.80.0070.00017.36
8.1.70.0030.00517.49
8.1.60.0000.00817.62
8.1.50.0040.00417.63
8.1.40.0000.00917.45
8.1.30.0000.00817.53
8.1.20.0000.00817.58
8.1.10.0040.00417.45
8.1.00.0080.00017.49
8.0.300.0040.00418.77
8.0.290.0000.00717.28
8.0.280.0000.00818.38
8.0.270.0000.00717.15
8.0.260.0030.00316.88
8.0.250.0070.00016.99
8.0.240.0060.00316.88
8.0.230.0030.00516.96
8.0.220.0030.00316.79
8.0.210.0030.00316.95
8.0.200.0000.00616.84
8.0.190.0050.00216.96
8.0.180.0070.00016.85
8.0.170.0040.00416.97
8.0.160.0040.00416.85
8.0.150.0030.00516.75
8.0.140.0070.00016.89
8.0.130.0030.00313.38
8.0.120.0000.00816.96
8.0.110.0040.00416.93
8.0.100.0050.00316.93
8.0.90.0000.00716.86
8.0.80.0060.01316.85
8.0.70.0050.00216.83
8.0.60.0000.00716.70
8.0.50.0070.00016.77
8.0.30.0120.00617.20
8.0.20.0070.01117.40
8.0.10.0020.00517.07
8.0.00.0120.01016.75
7.4.330.0020.00215.07
7.4.320.0040.00316.54
7.4.300.0030.00316.54
7.4.290.0030.00716.54
7.4.280.0000.00616.66
7.4.270.0000.00716.52
7.4.260.0000.00716.53
7.4.250.0000.00716.47
7.4.240.0030.00416.58
7.4.230.0040.00316.58
7.4.220.0100.00716.55
7.4.210.0070.01016.54
7.4.200.0000.00716.61
7.4.190.0000.00716.42
7.4.160.0130.00916.63
7.4.150.0130.01017.40
7.4.140.0050.01217.86
7.4.130.0120.00816.65
7.4.120.0100.01016.47
7.4.110.0170.00316.36
7.4.100.0170.00016.64
7.4.90.0090.00916.50
7.4.80.0130.00319.39
7.4.70.0110.00516.30
7.4.60.0070.01016.67
7.4.50.0000.00816.57
7.4.40.0000.01522.77
7.4.30.0030.01316.49
7.4.00.0070.00714.93
7.3.330.0000.00513.25
7.3.320.0020.00213.35
7.3.310.0070.00016.23
7.3.300.0000.00716.26
7.3.290.0120.00916.38
7.3.280.0040.01116.42
7.3.270.0100.00717.40
7.3.260.0100.01016.57
7.3.250.0150.00516.57
7.3.240.0120.00416.43
7.3.230.0100.00716.63
7.3.210.0070.01016.42
7.3.200.0040.01819.39
7.3.190.0090.01316.39
7.3.180.0070.01016.64
7.3.170.0120.00616.56
7.3.160.0090.00616.36
7.3.120.0040.01414.88
7.3.10.0110.01116.80
7.3.00.0160.00316.61
7.2.330.0110.00816.77
7.2.320.0000.01616.82
7.2.310.0140.00716.89
7.2.300.0040.01316.61
7.2.290.0130.00416.54
7.2.130.0000.01416.95
7.2.120.0070.01016.88
7.2.110.0030.01016.61
7.2.100.0100.00316.84
7.2.90.0000.01416.70
7.2.80.0130.00916.72
7.2.70.0110.00316.59
7.2.60.0100.00616.91
7.2.50.0110.00416.85
7.2.40.0070.00716.77
7.2.30.0110.01116.74
7.2.20.0100.01116.98
7.2.10.0140.01116.64
7.2.00.0060.00918.03
7.1.250.0080.00615.77
7.1.100.0080.00818.32
7.1.70.0000.00716.92
7.1.60.0100.01419.82
7.1.50.0130.01016.99
7.1.00.0000.07022.31
7.0.200.0100.00016.86
7.0.140.0000.07722.09
7.0.60.0170.07019.93
7.0.50.0130.08017.73
7.0.40.0130.08020.01
7.0.30.0200.03720.23
7.0.20.0430.07320.32
7.0.10.0130.07320.26
7.0.00.0130.07320.20
5.6.280.0070.07020.92
5.6.210.0130.06720.62
5.6.200.0030.05318.16
5.6.190.0170.08020.77
5.6.180.0230.08020.39
5.6.170.0200.05020.62
5.6.160.0000.04720.52
5.6.150.0000.05318.29
5.6.140.0100.06018.19
5.6.130.0030.05018.15
5.6.120.0070.04320.98
5.6.110.0130.07320.99
5.6.100.0030.05020.89
5.6.90.0070.07720.99
5.6.80.0130.04020.39
5.5.350.0000.08720.39
5.5.340.0100.05018.02
5.5.330.0070.04020.25
5.5.320.0070.06020.34
5.5.310.0230.04020.26
5.5.300.0070.05317.95
5.5.290.0030.06317.98
5.5.280.0070.06020.70
5.5.270.0100.07720.77
5.5.260.0070.08720.74
5.5.250.0100.05320.48
5.5.240.2670.02720.14
5.4.450.0370.05019.20
5.4.440.1070.07019.25
5.4.430.0130.05319.48
5.4.420.0870.04019.57
5.4.410.0470.06019.41
5.4.400.0170.04319.14
5.4.390.0300.03019.09
5.4.380.0930.05718.54
5.4.370.0830.04718.72
5.4.360.0600.05018.75
5.4.350.0800.04718.48
5.4.340.0970.06018.73
5.4.320.0070.04212.51
5.4.310.0070.03812.51
5.4.300.0080.03912.50
5.4.290.0050.04512.50
5.4.280.0100.03312.40
5.4.270.0100.04012.40
5.4.260.0050.03812.40
5.4.250.0070.05718.82
5.4.240.0070.06018.99
5.4.230.0200.06718.95
5.4.220.0030.05719.11
5.4.210.0070.05018.84
5.4.200.0070.05018.95
5.4.190.0130.04718.96
5.4.180.0070.06018.93
5.4.170.0030.05718.99
5.4.160.0030.05718.82
5.4.150.0030.05718.78
5.4.140.0030.05716.30
5.4.130.0100.05716.33
5.4.120.0200.04016.52
5.4.110.0170.04716.41
5.4.100.0070.05016.51
5.4.90.0100.05316.42
5.4.80.0130.04716.50
5.4.70.0100.05316.42
5.4.60.0200.05316.36
5.4.50.0030.05716.62
5.4.40.0070.05016.45
5.4.30.0130.04316.47
5.4.20.0100.05716.59
5.4.10.0100.05016.33
5.4.00.0100.05015.88
5.3.290.0080.04112.80
5.3.280.0030.06314.84
5.3.270.0030.05714.75
5.3.260.0170.04314.61
5.3.250.0070.07014.71
5.3.240.0070.05314.61
5.3.230.0070.05714.70
5.3.220.0170.05014.68
5.3.210.0170.06314.60
5.3.200.0030.05714.68
5.3.190.0100.07014.75
5.3.180.0130.04714.57
5.3.170.0230.03714.58
5.3.160.0070.05014.74
5.3.150.0070.05014.64
5.3.140.0100.07314.73
5.3.130.0100.05314.47
5.3.120.0200.05014.63
5.3.110.0230.06014.39
5.3.100.0100.05314.14
5.3.90.0200.03714.02
5.3.80.0030.06014.22
5.3.70.0100.05013.94
5.3.60.0100.04714.10
5.3.50.0130.05013.97
5.3.40.0070.05314.05
5.3.30.0070.05013.82
5.3.20.0200.05713.62
5.3.10.0100.06713.64
5.3.00.0170.05313.66
5.2.170.0070.04311.23
5.2.160.0030.04311.25
5.2.150.0030.06011.24
5.2.140.0070.04311.17
5.2.130.0030.04011.08
5.2.120.0030.04311.21
5.2.110.0130.04010.95
5.2.100.0030.04311.30
5.2.90.0130.04311.33
5.2.80.0100.03711.29
5.2.70.0070.04311.29
5.2.60.0030.05011.07
5.2.50.0100.04311.13
5.2.40.0130.04011.08
5.2.30.0130.05010.97
5.2.20.0170.05010.80
5.2.10.0030.04310.95
5.2.00.0070.05310.96
5.1.60.0130.02310.09
5.1.50.0130.02710.10
5.1.40.0170.0379.92
5.1.30.0000.04310.44
5.1.20.0000.04710.45
5.1.10.0100.03710.07
5.1.00.0030.03710.05
5.0.50.0070.0408.40
5.0.40.0030.0378.41
5.0.30.0030.0438.25
5.0.20.0030.0278.20
5.0.10.0130.0178.39
5.0.00.0030.0538.16
4.4.90.0100.0177.83
4.4.80.0030.0277.83
4.4.70.0070.0207.83
4.4.60.0030.0207.83
4.4.50.0000.0237.83
4.4.40.0030.0337.83
4.4.30.0030.0237.83
4.4.20.0000.0237.83
4.4.10.0000.0237.83
4.4.00.0100.0277.83
4.3.110.0030.0237.83
4.3.100.0000.0237.83
4.3.90.0000.0307.83
4.3.80.0000.0377.83
4.3.70.0000.0237.83
4.3.60.0030.0207.83
4.3.50.0100.0177.83
4.3.40.0000.0377.83
4.3.30.0030.0207.83
4.3.20.0030.0307.83
4.3.10.0000.0307.83
4.3.00.0000.02014.52

preferences:
34.18 ms | 401 KiB | 5 Q