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 function decode($N,$alphabet,$msg){ // Initialization $M = count($alphabet); $decrypt = array(); $decode = array(); $encrypted = preg_split("//",$msg, -1, PREG_SPLIT_NO_EMPTY); // Compute the decoding map $decode[' '] = ' '; foreach ($alphabet as $n=>$v){ $decode[$v] = $alphabet[($M+($n-$N)) % $M]; // Compute the decoding map for $v } foreach ($encrypted as $v){ $decrypt[] = $decode[$v]; } return join('',$decrypt); } $array = (array) $test; reset($array); $first_key = key($array); print_r($array[$first_key]); //used this to figure out the count: // http://rumkin.com/tools/cipher/caesar.php $key = decode(13,26, $array[$first_key]); // 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.0100.01016.74
8.3.50.0080.01222.13
8.3.40.0100.00718.67
8.3.30.0060.00919.09
8.3.20.0110.00420.34
8.3.10.0040.00421.86
8.3.00.0070.01019.26
8.2.180.0120.00318.53
8.2.170.0200.00022.96
8.2.160.0100.00720.34
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0030.00526.16
8.2.120.0090.00022.25
8.2.110.0060.00322.11
8.2.100.0070.00417.97
8.2.90.0060.00319.17
8.2.80.0030.00617.97
8.2.70.0030.00517.50
8.2.60.0080.00018.04
8.2.50.0000.01018.07
8.2.40.0080.00019.88
8.2.30.0050.00218.19
8.2.20.0040.00417.71
8.2.10.0060.00318.08
8.2.00.0050.00517.89
8.1.280.0090.00925.92
8.1.270.0040.00423.84
8.1.260.0060.00326.35
8.1.250.0040.00428.09
8.1.240.0030.00723.92
8.1.230.0120.00019.16
8.1.220.0030.00517.74
8.1.210.0080.00018.77
8.1.200.0000.01017.47
8.1.190.0030.00517.64
8.1.180.0030.00618.10
8.1.170.0040.00418.56
8.1.160.0090.00021.95
8.1.150.0060.00318.66
8.1.140.0040.00417.39
8.1.130.0030.00317.88
8.1.120.0040.00417.50
8.1.110.0030.00717.36
8.1.100.0050.00317.43
8.1.90.0000.00717.48
8.1.80.0000.00717.38
8.1.70.0040.00417.42
8.1.60.0040.00417.63
8.1.50.0000.00817.56
8.1.40.0030.00617.49
8.1.30.0080.00017.64
8.1.20.0040.00417.59
8.1.10.0040.00417.61
8.1.00.0000.00917.42
8.0.300.0080.00018.77
8.0.290.0040.00417.05
8.0.280.0000.00718.32
8.0.270.0050.00317.23
8.0.260.0030.00317.14
8.0.250.0000.00716.88
8.0.240.0070.00016.86
8.0.230.0020.00516.86
8.0.220.0070.00016.83
8.0.210.0070.00016.90
8.0.200.0030.00316.99
8.0.190.0000.00817.00
8.0.180.0070.00016.83
8.0.170.0080.00016.95
8.0.160.0040.00416.93
8.0.150.0000.00716.93
8.0.140.0000.00716.84
8.0.130.0030.00313.41
8.0.120.0040.00416.91
8.0.110.0000.00716.92
8.0.100.0000.00716.89
8.0.90.0050.00216.84
8.0.80.0130.00916.94
8.0.70.0030.00316.85
8.0.60.0000.00716.91
8.0.50.0040.00416.79
8.0.30.0120.00817.22
8.0.20.0080.01317.42
8.0.10.0000.00717.02
8.0.00.0070.01016.78
7.4.330.0060.00015.00
7.4.320.0080.00016.84
7.4.300.0000.00616.75
7.4.290.0070.00016.71
7.4.280.0040.00416.84
7.4.270.0000.00716.66
7.4.260.0030.00316.61
7.4.250.0040.00416.57
7.4.240.0000.00716.73
7.4.230.0000.00716.92
7.4.220.0130.00716.73
7.4.210.0080.00916.80
7.4.200.0050.00216.73
7.4.190.0070.00016.82
7.4.160.0080.00816.79
7.4.150.0070.01317.40
7.4.140.0130.00717.86
7.4.130.0090.01316.69
7.4.120.0130.00816.78
7.4.110.0160.00216.64
7.4.100.0090.00916.85
7.4.90.0090.00916.73
7.4.80.0060.01619.39
7.4.70.0060.01617.04
7.4.60.0060.01116.64
7.4.50.0080.00016.82
7.4.40.0070.00722.77
7.4.30.0070.01516.77
7.4.00.0040.00815.29
7.3.330.0030.00313.52
7.3.320.0000.00513.46
7.3.310.0000.00816.71
7.3.300.0030.00516.66
7.3.290.0090.00616.61
7.3.280.0110.00516.65
7.3.270.0030.01517.40
7.3.260.0070.01116.63
7.3.250.0120.00616.72
7.3.240.0060.01216.75
7.3.230.0040.01416.81
7.3.210.0030.01416.51
7.3.200.0040.01419.39
7.3.190.0160.00716.70
7.3.180.0060.01016.79
7.3.170.0100.00616.72
7.3.160.0040.01416.64
7.3.120.0030.01115.08
7.2.330.0160.01616.73
7.2.320.0100.00717.03
7.2.310.0060.01216.82
7.2.300.0070.01016.71
7.2.290.0030.01916.93
7.2.60.0030.01216.98
7.2.00.0100.00319.55
7.1.200.0040.00816.05
7.1.100.0080.00318.21
7.1.70.0040.01116.80
7.1.60.0130.01319.46
7.1.50.0110.00717.27
7.1.00.0000.08022.41
7.0.200.0000.00716.87
7.0.140.0070.07022.05
7.0.60.0070.03720.02
7.0.50.0130.07717.93
7.0.40.0130.05720.26
7.0.30.0500.04720.25
7.0.20.0170.04020.31
7.0.10.0070.06020.14
7.0.00.0130.06720.09
5.6.280.0070.06721.07
5.6.210.0130.07020.47
5.6.200.0030.05718.27
5.6.190.0000.04720.55
5.6.180.0200.05020.39
5.6.170.0270.07320.55
5.6.160.0070.07320.49
5.6.150.0070.04018.15
5.6.140.0070.07318.18
5.6.130.0030.05718.12
5.6.120.0070.04321.14
5.6.110.0170.07721.05
5.6.100.0170.07020.99
5.6.90.0070.04721.11
5.6.80.0070.03720.36
5.6.70.4270.04320.38
5.5.350.0200.08020.34
5.5.340.0030.07717.97
5.5.330.0100.07020.34
5.5.320.0330.07320.42
5.5.310.0330.08020.35
5.5.300.0100.03318.08
5.5.290.0070.06717.95
5.5.280.0070.07720.79
5.5.270.0100.08320.66
5.5.260.0070.08720.82
5.5.250.0130.06720.70
5.5.240.4170.04720.07
5.4.450.0800.05319.63
5.4.440.0700.07019.55
5.4.430.0670.05319.45
5.4.420.0430.07019.46
5.4.410.0930.06319.23
5.4.400.0070.05319.13
5.4.390.0330.06019.04
5.4.380.0300.05018.90
5.4.370.0400.05018.74
5.4.360.0230.05318.54
5.4.350.0300.05318.77
5.4.340.0370.04718.73
5.4.320.0090.04112.52
5.4.310.0050.05212.51
5.4.300.0090.03912.52
5.4.290.0060.05512.50
5.4.280.0150.05312.39
5.4.270.0060.04812.39
5.4.260.0120.05812.39
5.4.250.0030.04312.39
5.4.240.0100.03612.40
5.4.230.0070.04412.38
5.4.220.0040.04212.39
5.4.210.0030.04312.38
5.4.200.0100.05012.39
5.4.190.0080.05212.38
5.4.180.0070.03712.38
5.4.170.0060.03712.39
5.4.160.0040.03812.39
5.4.150.0060.03812.39
5.4.140.0060.04012.06
5.4.130.0080.03512.06
5.4.120.0020.04012.01
5.4.110.0060.03612.01
5.4.100.0140.04712.01
5.4.90.0080.03712.01
5.4.80.0090.03912.01
5.4.70.0090.05012.01
5.4.60.0060.05312.01
5.4.50.0070.04012.00
5.4.40.0070.03612.00
5.4.30.0070.05011.99
5.4.20.0090.07311.99
5.4.10.0090.05811.99
5.4.00.0070.06111.48
5.3.290.0120.03912.80
5.3.280.0140.04912.71
5.3.270.0090.04912.72
5.3.260.0090.04112.72
5.3.250.0070.04112.71
5.3.240.0090.03912.72
5.3.230.0050.04112.71
5.3.220.0100.04112.68
5.3.210.0080.04612.68
5.3.200.0060.05112.68
5.3.190.0130.04312.68
5.3.180.0080.05012.67
5.3.170.0210.13212.67
5.3.160.0130.04612.68
5.3.150.0090.05912.67
5.3.140.0110.06512.66
5.3.130.0090.06412.66
5.3.120.0100.03812.66
5.3.110.0110.03812.66
5.3.100.0030.04312.13
5.3.90.0050.03912.11
5.3.80.0070.03712.10
5.3.70.0060.04512.10
5.3.60.0040.04112.09
5.3.50.0070.03612.03
5.3.40.0080.04312.04
5.3.30.0100.05011.99
5.3.20.0060.04011.77
5.3.10.0080.03911.74
5.3.00.0090.03811.72
5.2.170.0050.0339.23
5.2.160.0030.0379.23
5.2.150.0060.0369.23
5.2.140.0090.0339.23
5.2.130.0080.0329.19
5.2.120.0090.0349.19
5.2.110.0050.0329.19
5.2.100.0050.0329.19
5.2.90.0080.0399.19
5.2.80.0050.0409.18
5.2.70.0030.0359.18
5.2.60.0150.0619.14
5.2.50.0130.0499.11
5.2.40.0080.0329.09
5.2.30.0040.0389.07
5.2.20.0120.0409.05
5.2.10.0040.0348.96
5.2.00.0050.0348.82
5.1.60.0070.0228.11
5.1.50.0040.0278.11
5.1.40.0160.0588.09
5.1.30.0080.0308.44
5.1.20.0050.0308.46
5.1.10.0080.0368.18
5.1.00.0070.0328.19
5.0.50.0090.0196.67
5.0.40.0030.0236.53
5.0.30.0070.0496.34
5.0.20.0070.0266.31
5.0.10.0100.0286.28
5.0.00.0060.0456.28
4.4.90.0040.0214.78
4.4.80.0070.0174.75
4.4.70.0090.0664.75
4.4.60.0060.0184.75
4.4.50.0050.0204.77
4.4.40.0160.0824.71
4.4.30.0050.0234.76
4.4.20.0260.0484.84
4.4.10.0140.0354.84
4.4.00.0040.0254.76
4.3.110.0050.0174.67
4.3.100.0040.0224.66
4.3.90.0090.0344.64
4.3.80.0120.0474.58
4.3.70.0130.0394.63
4.3.60.0160.0384.63
4.3.50.0030.0244.62
4.3.40.0040.0324.54
4.3.30.0030.0303.30
4.3.20.0070.0353.28
4.3.10.0030.0203.24
4.3.00.0270.01710.54

preferences:
37.81 ms | 401 KiB | 5 Q