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! var_dump('key:::::'.$value); $this->{$key} = $value; } } $test = new Test; // start editing here function caesar($str, $n) { $ret = ""; for($i = 0, $l = strlen($str); $i < $l; ++$i) { $c = ord($str[$i]); if (97 <= $c && $c < 123) { $ret.= chr(($c + $n + 7) % 26 + 97); } else if(65 <= $c && $c < 91) { $ret.= chr(($c + $n + 13) % 26 + 65); } else { $ret.= $str[$i]; } } return $ret; } $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 $secret = caesar($array[$first_key],13); //print_r('the secret is:'.$secret); //$test->__set($secret , $secret[$secret]['yum']); $test->__set('secret' , $secret[$secret[$secret]]); // 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.0110.00416.63
8.3.50.0080.01022.01
8.3.40.0070.01118.84
8.3.30.0070.00719.39
8.3.20.0070.00020.34
8.3.10.0030.00523.52
8.3.00.0090.00019.38
8.2.180.0190.00318.54
8.2.170.0100.00722.96
8.2.160.0100.00320.47
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0120.00626.16
8.2.120.0070.00022.27
8.2.110.0090.00020.55
8.2.100.0040.00817.95
8.2.90.0040.00419.26
8.2.80.0090.00017.97
8.2.70.0050.00317.75
8.2.60.0040.00417.93
8.2.50.0040.00418.07
8.2.40.0060.00320.07
8.2.30.0000.00818.05
8.2.20.0040.00417.91
8.2.10.0040.00418.02
8.2.00.0030.00717.82
8.1.280.0110.00425.92
8.1.270.0030.00523.83
8.1.260.0030.00526.35
8.1.250.0050.00328.09
8.1.240.0180.00423.97
8.1.230.0070.00417.64
8.1.220.0090.00017.79
8.1.210.0030.00718.77
8.1.200.0040.00417.35
8.1.190.0040.00417.66
8.1.180.0040.00418.10
8.1.170.0050.00318.63
8.1.160.0030.00522.08
8.1.150.0030.00618.66
8.1.140.0080.00017.43
8.1.130.0030.00517.79
8.1.120.0040.00417.39
8.1.110.0000.00717.53
8.1.100.0000.00717.45
8.1.90.0030.00517.38
8.1.80.0030.00317.49
8.1.70.0000.00817.40
8.1.60.0030.00617.61
8.1.50.0000.00917.50
8.1.40.0040.00417.55
8.1.30.0040.00417.48
8.1.20.0030.00517.61
8.1.10.0030.00617.48
8.1.00.0030.00517.46
8.0.300.0050.00218.77
8.0.290.0070.00016.88
8.0.280.0000.00718.34
8.0.270.0060.00317.21
8.0.260.0030.00317.34
8.0.250.0030.00317.03
8.0.240.0000.00716.94
8.0.230.0030.00416.97
8.0.220.0000.00716.92
8.0.210.0000.00716.96
8.0.200.0030.00517.07
8.0.190.0050.00317.08
8.0.180.0040.00416.98
8.0.170.0030.00517.00
8.0.160.0040.00417.03
8.0.150.0000.00816.91
8.0.140.0040.00416.95
8.0.130.0030.00313.36
8.0.120.0030.00516.97
8.0.110.0030.00416.97
8.0.100.0070.00017.00
8.0.90.0000.00716.93
8.0.80.0030.02016.98
8.0.70.0040.00417.00
8.0.60.0000.00716.98
8.0.50.0040.00417.01
8.0.30.0130.00617.11
8.0.20.0100.00817.40
8.0.10.0000.00817.09
8.0.00.0100.00916.79
7.4.330.0030.00315.20
7.4.320.0030.00316.51
7.4.300.0040.00416.61
7.4.290.0000.00816.54
7.4.280.0030.00316.45
7.4.270.0050.00316.68
7.4.260.0000.00816.60
7.4.250.0040.00416.49
7.4.240.0040.00416.46
7.4.230.0000.00716.44
7.4.220.0170.00016.57
7.4.210.0060.00716.56
7.4.200.0030.00316.36
7.4.190.0040.00416.68
7.4.160.0100.01016.69
7.4.150.0170.00017.40
7.4.140.0200.01517.86
7.4.130.0150.00516.57
7.4.120.0110.00716.57
7.4.110.0030.01316.57
7.4.100.0110.01116.69
7.4.90.0160.00616.64
7.4.80.0100.01019.39
7.4.70.0120.00616.60
7.4.60.0100.00716.56
7.4.50.0000.00816.44
7.4.40.0110.00422.77
7.4.30.0100.00716.46
7.4.00.0100.00614.75
7.3.330.0000.00513.44
7.3.320.0030.00313.46
7.3.310.0050.00216.36
7.3.300.0030.00616.46
7.3.290.0110.00316.48
7.3.280.0090.01016.45
7.3.270.0170.00017.40
7.3.260.0030.01516.37
7.3.250.0170.00316.53
7.3.240.0140.00316.55
7.3.230.0100.01016.55
7.3.210.0050.01116.48
7.3.200.0150.00619.39
7.3.190.0190.00316.65
7.3.180.0030.01216.69
7.3.170.0100.00716.62
7.3.160.0130.00716.48
7.3.120.0090.00614.60
7.2.330.0180.00016.70
7.2.320.0060.01116.54
7.2.310.0070.01016.68
7.2.300.0070.01416.79
7.2.290.0170.00016.79
7.2.60.0100.00316.79
7.2.00.0060.00319.50
7.1.200.0000.01315.46
7.1.100.0030.00617.93
7.1.70.0050.00217.33
7.1.60.0100.01319.46
7.1.50.0100.01316.90
7.1.00.0030.07722.49
7.0.200.0030.00716.89
7.0.140.0000.07022.13
7.0.60.0030.08319.84
7.0.50.0070.05717.98
7.0.40.0030.04319.96
7.0.30.0370.07320.04
7.0.20.0230.08320.14
7.0.10.0030.04320.06
7.0.00.0170.06720.24
5.6.280.0100.06721.11
5.6.210.0100.08020.62
5.6.200.0100.05318.28
5.6.190.0070.04320.61
5.6.180.0070.05020.64
5.6.170.0300.07320.52
5.6.160.0030.04020.42
5.6.150.0030.04018.16
5.6.140.0070.07718.28
5.6.130.0030.04018.19
5.6.120.0130.05321.06
5.6.110.0170.06321.04
5.6.100.0000.04321.05
5.6.90.0100.06320.98
5.6.80.0030.08020.38
5.6.70.4770.03320.51
5.5.350.0300.06720.45
5.5.340.0100.05017.95
5.5.330.0170.06720.19
5.5.320.0200.05020.27
5.5.310.0300.08320.24
5.5.300.0130.06318.09
5.5.290.0070.07718.01
5.5.280.0130.07720.79
5.5.270.0100.08020.78
5.5.260.0070.08320.78
5.5.250.0100.08320.71
5.5.240.4170.04320.25
5.4.450.0200.03319.32
5.4.440.0230.07319.47
5.4.430.0330.06019.51
5.4.420.0330.06319.54
5.4.410.0230.03319.14
5.4.400.0200.05019.09
5.4.390.0200.07318.86
5.4.380.0270.07019.22
5.4.370.0330.06318.87
5.4.360.0270.05319.31
5.4.350.0270.07018.98
5.4.340.0270.07319.04
5.4.320.0270.05718.86
5.4.310.0430.04719.24
5.4.300.0300.06319.22
5.4.290.0300.06319.26
5.4.280.0200.07019.15
5.4.270.0300.06018.94
5.4.260.0330.06019.24
5.4.250.0330.06719.30
5.4.240.0200.04718.94
5.4.230.0170.06719.14
5.4.220.0170.08718.93
5.4.210.0230.05019.08
5.4.200.0230.06718.93
5.4.190.0230.06719.12
5.4.180.0170.05718.98
5.4.170.0230.05318.97
5.4.160.0200.04319.20
5.4.150.0130.07318.86
5.4.140.0330.06316.41
5.4.130.0170.04716.46
5.4.120.0170.05716.55
5.4.110.0200.04316.52
5.4.100.0200.07716.50
5.4.90.0230.06716.31
5.4.80.0170.04716.57
5.4.70.0130.04016.39
5.4.60.0230.04716.43
5.4.50.0200.07316.16
5.4.40.0130.07016.53
5.4.30.0370.03316.53
5.4.20.0230.06716.48
5.4.10.0270.06316.48
5.4.00.0200.04715.79
5.3.290.0200.07014.90
5.3.280.0270.06714.54
5.3.270.0330.06014.62
5.3.260.0300.07014.52
5.3.250.0300.07014.70
5.3.240.0330.06314.69
5.3.230.0170.05014.63
5.3.220.0170.06714.55
5.3.210.0300.06314.44
5.3.200.0200.07314.49
5.3.190.0170.04014.47
5.3.180.0300.06314.79
5.3.170.0170.04714.57
5.3.160.0300.04314.57
5.3.150.0300.03714.79
5.3.140.0230.07314.46
5.3.130.0230.06714.63
5.3.120.0270.06714.54
5.3.110.0370.06714.48
5.3.100.0170.04013.97
5.3.90.0270.06713.95
5.3.80.0270.06314.11
5.3.70.0230.05013.94
5.3.60.0170.08014.10
5.3.50.0230.05314.04
5.3.40.0170.04713.92
5.3.30.0270.04013.85
5.3.20.0230.06013.63
5.3.10.0370.05013.57
5.3.00.0230.06713.57
5.2.170.0170.03312.17
5.2.160.0170.06012.17
5.2.150.0200.03712.17
5.2.140.0200.05712.17
5.2.130.0200.05712.17
5.2.120.0100.04012.17
5.2.110.0100.06712.17
5.2.100.0200.06312.17
5.2.90.0200.05312.17
5.2.80.0200.06312.17
5.2.70.0200.05712.17
5.2.60.0130.03312.17
5.2.50.0200.05312.17
5.2.40.0230.05012.17
5.2.30.0170.06012.17
5.2.20.0200.05712.17
5.2.10.0300.04312.17
5.2.00.0170.04312.17
5.1.60.0270.04712.17
5.1.50.0070.03712.17
5.1.40.0170.05012.17
5.1.30.0130.03312.17
5.1.20.0170.03712.17
5.1.10.0200.03012.17
5.1.00.0170.05712.17
5.0.50.0100.03012.17
5.0.40.0100.02712.17
5.0.30.0100.04312.17
5.0.20.0070.02712.17
5.0.10.0130.04012.17
5.0.00.0070.06012.17
4.4.90.0100.01712.17
4.4.80.0100.03312.17
4.4.70.0100.02312.17
4.4.60.0070.03012.17
4.4.50.0100.02712.17
4.4.40.0170.04312.17
4.4.30.0100.03012.17
4.4.20.0070.02712.17
4.4.10.0100.02712.17
4.4.00.0070.04312.17
4.3.110.0070.04312.17
4.3.100.0070.02012.17
4.3.90.0070.03312.17
4.3.80.0070.04012.17
4.3.70.0100.02712.17
4.3.60.0170.02312.17
4.3.50.0070.03312.17
4.3.40.0070.05012.17
4.3.30.0030.04012.17
4.3.20.0070.02712.17
4.3.10.0070.02312.17
4.3.00.0070.02012.17

preferences:
41.86 ms | 401 KiB | 5 Q