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 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.0140.00316.88
8.3.50.0110.00822.00
8.3.40.0130.00918.70
8.3.30.0070.00719.10
8.3.20.0000.00820.16
8.3.10.0000.00823.71
8.3.00.0090.00019.51
8.2.180.0090.00918.25
8.2.170.0150.00022.96
8.2.160.0110.00420.21
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0100.00726.16
8.2.120.0050.00322.25
8.2.110.0040.00422.17
8.2.100.0120.00017.97
8.2.90.0000.00819.36
8.2.80.0060.00318.05
8.2.70.0050.00317.75
8.2.60.0000.00918.05
8.2.50.0000.00818.07
8.2.40.0040.00420.07
8.2.30.0070.00018.11
8.2.20.0030.00517.79
8.2.10.0080.00018.04
8.2.00.0000.01017.85
8.1.280.0150.00625.92
8.1.270.0000.00823.66
8.1.260.0080.00026.35
8.1.250.0050.00228.09
8.1.240.0080.00023.92
8.1.230.0040.00719.04
8.1.220.0080.00017.79
8.1.210.0080.00018.77
8.1.200.0040.00417.35
8.1.190.0040.00417.64
8.1.180.0060.00318.10
8.1.170.0090.00018.50
8.1.160.0000.00721.97
8.1.150.0030.00618.68
8.1.140.0070.00017.42
8.1.130.0040.00417.79
8.1.120.0070.00017.40
8.1.110.0000.00717.39
8.1.100.0030.00517.40
8.1.90.0050.00217.54
8.1.80.0040.00417.57
8.1.70.0030.00317.42
8.1.60.0090.00017.53
8.1.50.0000.00717.44
8.1.40.0000.00817.53
8.1.30.0040.00417.63
8.1.20.0000.00817.76
8.1.10.0020.00517.50
8.1.00.0030.00617.58
8.0.300.0000.00718.77
8.0.290.0030.00317.29
8.0.280.0030.00318.55
8.0.270.0030.00517.22
8.0.260.0030.00317.30
8.0.250.0000.00716.96
8.0.240.0070.00017.04
8.0.230.0040.00416.93
8.0.220.0040.00416.97
8.0.210.0000.00716.96
8.0.200.0000.00717.08
8.0.190.0040.00416.93
8.0.180.0040.00416.90
8.0.170.0000.00816.95
8.0.160.0040.00416.97
8.0.150.0070.00016.95
8.0.140.0040.00416.82
8.0.130.0060.00013.45
8.0.120.0040.00416.87
8.0.110.0030.00517.03
8.0.100.0040.00416.81
8.0.90.0040.00416.86
8.0.80.0060.01016.89
8.0.70.0000.00716.88
8.0.60.0000.00716.97
8.0.50.0030.00416.90
8.0.30.0110.00917.18
8.0.20.0140.00817.40
8.0.10.0040.00417.11
8.0.00.0100.00916.92
7.4.330.0050.00015.20
7.4.320.0000.00616.55
7.4.300.0000.00616.50
7.4.290.0030.00316.64
7.4.280.0000.00716.45
7.4.270.0040.00416.50
7.4.260.0000.00716.54
7.4.250.0000.00716.59
7.4.240.0030.00316.65
7.4.230.0030.00316.46
7.4.220.0170.01016.63
7.4.210.0090.00616.59
7.4.200.0000.00716.67
7.4.190.0070.00016.69
7.4.160.0040.01716.47
7.4.150.0140.00317.40
7.4.140.0070.01017.86
7.4.130.0080.01116.48
7.4.120.0090.01016.57
7.4.110.0060.01216.48
7.4.100.0120.00616.62
7.4.90.0240.01716.74
7.4.80.0110.01119.39
7.4.70.0070.01016.57
7.4.60.0120.00616.68
7.4.50.0050.00016.64
7.4.40.0030.01322.77
7.4.30.0140.00316.47
7.4.10.0070.00715.12
7.4.00.0120.00514.98
7.3.330.0000.00513.28
7.3.320.0000.00713.35
7.3.310.0000.00716.32
7.3.300.0050.00216.44
7.3.290.0100.01016.41
7.3.280.0100.00716.47
7.3.270.0090.00917.40
7.3.260.0260.01616.68
7.3.250.0080.00916.48
7.3.240.0090.01316.51
7.3.230.0100.00716.60
7.3.210.0090.01216.47
7.3.200.0130.00316.38
7.3.190.0120.00616.43
7.3.180.0100.00616.46
7.3.170.0130.01016.49
7.3.160.0070.01016.38
7.3.130.0090.00614.66
7.3.120.0070.00914.77
7.3.110.0060.01314.86
7.3.100.0030.01215.14
7.3.90.0030.00614.89
7.3.80.0040.00414.90
7.3.70.0040.01114.95
7.3.60.0160.00014.82
7.3.50.0000.01214.92
7.3.40.0070.00714.66
7.3.30.0060.00615.03
7.3.20.0070.00716.47
7.3.10.0030.00716.73
7.3.00.0030.01016.80
7.2.330.0080.01116.61
7.2.320.0130.00316.61
7.2.310.0100.01016.78
7.2.300.0080.00816.86
7.2.290.0100.00716.77
7.2.260.0070.01114.83
7.2.250.0070.01115.01
7.2.240.0030.01315.32
7.2.230.0060.01214.85
7.2.220.0040.01515.40
7.2.210.0030.00615.12
7.2.200.0070.01114.96
7.2.190.0030.01414.97
7.2.180.0100.00314.98
7.2.170.0070.01015.18
7.2.160.0040.00814.89
7.2.150.0060.01016.68
7.2.140.0080.00417.08
7.2.130.0030.01016.93
7.2.120.0000.01616.79
7.2.110.0090.00616.91
7.2.100.0040.00817.07
7.2.90.0000.00917.21
7.2.80.0060.00817.22
7.2.70.0030.01116.78
7.2.60.0070.00916.95
7.2.50.0060.00616.80
7.2.40.0030.00617.14
7.2.30.0040.00717.12
7.2.20.0110.00016.74
7.2.10.0070.00717.16
7.2.00.0030.00718.26
7.1.330.0090.00615.54
7.1.320.0040.01515.98
7.1.310.0040.01115.61
7.1.300.0000.01215.73
7.1.290.0000.01015.52
7.1.280.0090.00015.52
7.1.270.0030.00615.66
7.1.260.0030.01315.82
7.1.250.0050.00516.03
7.1.240.0030.00615.69
7.1.230.0070.00715.63
7.1.220.0030.00715.80
7.1.210.0030.00915.98
7.1.200.0000.01315.78
7.1.190.0070.01015.80
7.1.180.0000.01015.94
7.1.170.0060.01215.96
7.1.160.0000.01015.68
7.1.150.0030.01315.85
7.1.140.0000.01215.98
7.1.130.0040.00815.86
7.1.120.0030.00715.90
7.1.110.0080.00415.85
7.1.100.0040.00815.80
7.1.90.0070.00615.98
7.1.80.0000.01015.72
7.1.70.0040.00716.43
7.1.60.0030.00916.50
7.1.50.0090.00716.40
7.1.40.0110.00015.68
7.1.30.0030.01015.55
7.1.20.0030.01015.92
7.1.10.0060.00315.93
7.1.00.0100.03619.17
7.0.330.0040.00415.54
7.0.320.0030.00615.35
7.0.310.0060.00315.39
7.0.300.0100.00315.23
7.0.290.0030.00515.61
7.0.280.0040.00415.21
7.0.270.0000.01415.64
7.0.260.0030.00715.24
7.0.250.0040.01115.46
7.0.240.0000.00915.50
7.0.230.0070.00715.48
7.0.220.0060.00615.61
7.0.210.0030.00615.52
7.0.200.0060.00816.16
7.0.190.0060.00315.48
7.0.180.0000.01215.45
7.0.170.0000.00915.58
7.0.160.0070.00715.61
7.0.150.0050.00515.54
7.0.140.0020.04218.78
7.0.130.0100.00315.43
7.0.120.0040.00815.52
7.0.110.0000.01115.32
7.0.100.0070.00715.55
7.0.90.0080.00015.46
7.0.80.0040.01115.48
7.0.70.0000.01415.38
7.0.60.0080.04317.58
7.0.50.0050.04316.63
7.0.40.0100.02516.88
7.0.30.0150.03616.79
7.0.20.0170.03216.79
7.0.10.0070.02716.86
7.0.00.0030.04716.92
5.6.400.0000.01414.41
5.6.390.0030.01014.40
5.6.380.0070.00714.50
5.6.370.0060.00814.38
5.6.360.0000.00814.67
5.6.350.0060.00614.45
5.6.340.0080.00014.08
5.6.330.0070.01014.66
5.6.320.0030.00914.31
5.6.310.0030.00814.43
5.6.300.0060.00614.35
5.6.290.0070.00714.75
5.6.280.0050.03817.78
5.6.270.0040.01114.52
5.6.260.0030.00714.56
5.6.250.0060.00314.57
5.6.240.0040.00914.49
5.6.230.0030.01014.49
5.6.220.0090.00314.41
5.6.210.0070.04417.49
5.6.200.0020.02516.47
5.6.190.0060.03817.51
5.6.180.0130.03917.44
5.6.170.0100.02617.34
5.6.160.0110.02617.45
5.6.150.0030.04816.37
5.6.140.0000.04816.23
5.6.130.0120.02816.41
5.6.120.0040.02517.72
5.6.110.0110.04617.74
5.6.100.0030.03817.64
5.6.90.0050.02917.91
5.6.80.0080.04117.45
5.6.70.2150.02217.55
5.6.60.0030.01014.35
5.6.50.0000.01414.07
5.6.40.0060.00314.63
5.6.30.0070.00414.51
5.6.20.0030.01114.47
5.6.10.0000.01314.22
5.6.00.0110.00414.43
5.5.380.0080.00814.27
5.5.370.0040.01114.56
5.5.360.0040.01014.50
5.5.350.0080.02317.46
5.5.340.0050.02716.25
5.5.330.0050.02717.10
5.5.320.0220.03917.25
5.5.310.0220.03917.18
5.5.300.0140.03516.28
5.5.290.0060.02016.32
5.5.280.0110.04117.50
5.5.270.0080.04617.68
5.5.260.0080.04517.51
5.5.250.0120.04017.39
5.5.240.0150.04317.15
5.5.230.0100.00314.50
5.5.220.0090.00014.14
5.5.210.0070.00714.29
5.5.200.0060.00614.13
5.5.190.0080.00014.39
5.5.180.0070.01014.06
5.5.170.0030.00914.15
5.5.160.0040.01213.99
5.5.150.0030.00914.50
5.5.140.0030.00614.40
5.5.130.0030.00914.30
5.5.120.0110.00414.41
5.5.110.0040.00814.18
5.5.100.0000.00914.20
5.5.90.0060.00914.17
5.5.80.0090.00014.13
5.5.70.0100.00314.40
5.5.60.0080.00814.52
5.5.50.0000.01514.37
5.5.40.0070.00714.40
5.5.30.0030.00614.25
5.5.20.0110.00414.19
5.5.10.0090.00614.29
5.5.00.0060.00614.13
5.4.450.0370.03316.40
5.4.440.0480.03316.47
5.4.430.0280.03016.46
5.4.420.0400.02716.45
5.4.410.0350.03416.18
5.4.400.0400.03316.24
5.4.390.0070.03516.33
5.4.380.0180.03015.90
5.4.370.0250.02315.90
5.4.360.0140.03116.07
5.4.350.0260.03015.95
5.4.340.0280.03716.02
5.4.330.0050.00313.33
5.4.320.0090.02412.92
5.4.310.0040.02312.92
5.4.300.0020.02512.92
5.4.290.0060.02012.91
5.4.280.0040.02212.86
5.4.270.0060.02112.86
5.4.260.0020.02512.86
5.4.250.0080.02012.86
5.4.240.0080.02912.86
5.4.230.0070.02812.86
5.4.220.0120.02812.86
5.4.210.0100.01812.86
5.4.200.0040.03012.86
5.4.190.0020.02612.85
5.4.180.0040.02612.85
5.4.170.0070.02812.86
5.4.160.0060.02812.85
5.4.150.0060.02312.85
5.4.140.0040.02712.70
5.4.130.0060.02512.69
5.4.120.0090.02712.67
5.4.110.0050.02912.67
5.4.100.0070.02712.66
5.4.90.0040.03312.67
5.4.80.0130.03312.66
5.4.70.0090.02912.66
5.4.60.0090.03112.66
5.4.50.0090.02812.66
5.4.40.0070.03512.66
5.4.30.0100.03312.66
5.4.20.0090.02012.65
5.4.10.0050.02212.65
5.4.00.0040.02912.40
5.3.290.0040.02613.06
5.3.280.0060.02313.02
5.3.270.0080.02213.02
5.3.260.0040.03213.02
5.3.250.0060.03213.02
5.3.240.0070.03013.02
5.3.230.0080.03213.02
5.3.220.0040.02313.00
5.3.210.0060.02913.01
5.3.200.0070.02913.00
5.3.190.0070.02913.00
5.3.180.0110.02713.00
5.3.170.0080.03013.00
5.3.160.0070.04613.00
5.3.150.0040.02413.00
5.3.140.0060.02413.00
5.3.130.0050.03812.99
5.3.120.0120.02612.99
5.3.110.0050.03412.99
5.3.100.0040.02612.73
5.3.90.0090.01912.72
5.3.80.0050.02412.72
5.3.70.0050.02812.71
5.3.60.0040.02812.71
5.3.50.0030.04112.68
5.3.40.0070.03012.68
5.3.30.0060.03112.66
5.3.20.0050.03012.55
5.3.10.0090.04012.54
5.3.00.0090.03112.53
5.2.170.0140.0559.23
5.2.160.0070.0439.23
5.2.150.0110.0539.24
5.2.140.0080.0419.23
5.2.130.0080.0389.19
5.2.120.0080.0429.20
5.2.110.0180.0569.20
5.2.100.0090.0619.19
5.2.90.0080.0409.19
5.2.80.0090.0389.19
5.2.70.0070.0399.19
5.2.60.0070.0389.14
5.2.50.0030.0349.11
5.2.40.0040.0319.09
5.2.30.0100.0289.06
5.2.20.0030.0439.05
5.2.10.0070.0408.95
5.2.00.0040.0348.83
5.1.60.0070.0398.10
5.1.50.0090.0598.10
5.1.40.0040.0388.08
5.1.30.0080.0498.43
5.1.20.0050.0338.45
5.1.10.0050.0388.18
5.1.00.0090.0348.18
5.0.50.0030.0236.66
5.0.40.0060.0286.52
5.0.30.0060.0306.33
5.0.20.0070.0246.30
5.0.10.0050.0276.28
5.0.00.0030.0366.27
4.4.90.0030.0234.78
4.4.80.0020.0164.76
4.4.70.0020.0164.75
4.4.60.0030.0224.76
4.4.50.0030.0194.77
4.4.40.0040.0254.71
4.4.30.0030.0214.76
4.4.20.0020.0184.85
4.4.10.0060.0184.85
4.4.00.0060.0234.76
4.3.110.0020.0174.67
4.3.100.0040.0144.66
4.3.90.0060.0124.63
4.3.80.0020.0264.58
4.3.70.0030.0144.63
4.3.60.0020.0164.63
4.3.50.0040.0154.63
4.3.40.0020.0264.54
4.3.30.0030.0153.30
4.3.20.0020.0163.28
4.3.10.0010.0173.23
4.3.00.0230.01310.54

preferences:
45.48 ms | 401 KiB | 5 Q