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 var_dump('key:::::'.$v()); $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.70.0150.00618.56
8.3.60.0090.00616.88
8.3.50.0120.00821.94
8.3.40.0140.00418.73
8.3.30.0040.01119.04
8.3.20.0040.00420.34
8.3.10.0060.00323.52
8.3.00.0030.00619.50
8.2.180.0140.00718.54
8.2.170.0100.00722.96
8.2.160.0070.00720.52
8.2.150.0000.00824.18
8.2.140.0000.00824.66
8.2.130.0150.00626.16
8.2.120.0080.00022.11
8.2.110.0080.00322.02
8.2.100.0090.00317.97
8.2.90.0040.00419.20
8.2.80.0030.00617.97
8.2.70.0030.00617.50
8.2.60.0090.00017.93
8.2.50.0040.00418.07
8.2.40.0040.00419.95
8.2.30.0080.00018.02
8.2.20.0040.00417.91
8.2.10.0060.00318.14
8.2.00.0070.00317.76
8.1.280.0030.01025.92
8.1.270.0040.00423.87
8.1.260.0000.00826.35
8.1.250.0000.00828.09
8.1.240.0060.00322.60
8.1.230.0060.00617.57
8.1.220.0080.00017.74
8.1.210.0070.00418.77
8.1.200.0070.00317.35
8.1.190.0050.00317.53
8.1.180.0060.00518.10
8.1.170.0080.00018.63
8.1.160.0040.00421.96
8.1.150.0060.00318.67
8.1.140.0000.00717.47
8.1.130.0070.00017.78
8.1.120.0040.00417.45
8.1.110.0040.00417.41
8.1.100.0040.00417.50
8.1.90.0070.00017.49
8.1.80.0030.00317.51
8.1.70.0000.00717.45
8.1.60.0040.00417.63
8.1.50.0090.00017.49
8.1.40.0050.00317.40
8.1.30.0050.00317.55
8.1.20.0040.00417.64
8.1.10.0060.00317.49
8.1.00.0000.00817.48
8.0.300.0040.00418.77
8.0.290.0060.00316.75
8.0.280.0000.00718.49
8.0.270.0040.00417.34
8.0.260.0000.00617.30
8.0.250.0040.00417.00
8.0.240.0040.00417.01
8.0.230.0040.00417.00
8.0.220.0000.00716.90
8.0.210.0050.00316.96
8.0.200.0020.00517.00
8.0.190.0000.00917.09
8.0.180.0000.00716.99
8.0.170.0040.00416.96
8.0.160.0000.00717.04
8.0.150.0060.00316.91
8.0.140.0040.00416.98
8.0.130.0000.00613.43
8.0.120.0000.00816.94
8.0.110.0000.00716.82
8.0.100.0040.00416.85
8.0.90.0040.00416.97
8.0.80.0040.01216.86
8.0.70.0040.00416.87
8.0.60.0020.00517.05
8.0.50.0040.00417.00
8.0.30.0100.00917.10
8.0.20.0090.00917.40
8.0.10.0000.00717.22
8.0.00.0110.01016.84
7.4.330.0000.00615.17
7.4.320.0060.00016.52
7.4.300.0030.00316.38
7.4.290.0040.00416.66
7.4.280.0030.00516.47
7.4.270.0000.00716.64
7.4.260.0060.00316.54
7.4.250.0050.00216.52
7.4.240.0040.00416.53
7.4.230.0000.00716.54
7.4.220.0100.01316.47
7.4.210.0060.00816.65
7.4.200.0030.00316.73
7.4.190.0070.00016.49
7.4.160.0090.00616.53
7.4.150.0110.00717.40
7.4.140.0080.01117.86
7.4.130.0090.01116.56
7.4.120.0110.00716.61
7.4.110.0100.00716.50
7.4.100.0190.00016.61
7.4.90.0070.01016.47
7.4.80.0070.01019.39
7.4.70.0060.01016.38
7.4.60.0030.01216.50
7.4.50.0000.00816.68
7.4.40.0070.01022.77
7.4.30.0090.00616.55
7.4.00.0080.00714.91
7.3.330.0000.00513.28
7.3.320.0070.00013.47
7.3.310.0060.00316.47
7.3.300.0050.00216.50
7.3.290.0060.00916.39
7.3.280.0100.00816.46
7.3.270.0070.01017.40
7.3.260.0060.00916.53
7.3.250.0160.00316.47
7.3.240.0030.01316.56
7.3.230.0130.00716.57
7.3.210.0100.01016.64
7.3.200.0130.01419.39
7.3.190.0090.00816.40
7.3.180.0070.00716.61
7.3.170.0100.00716.63
7.3.160.0130.00716.40
7.3.120.0100.00714.98
7.3.110.0170.00014.94
7.3.100.0030.01314.82
7.3.90.0060.00614.96
7.3.80.0060.00614.85
7.3.70.0060.01214.92
7.3.60.0000.01414.92
7.3.50.0030.00914.80
7.3.40.0030.00615.01
7.3.30.0070.00714.70
7.3.20.0060.01016.72
7.3.10.0090.00616.51
7.3.00.0140.00316.70
7.2.330.0140.00416.82
7.2.320.0100.00716.71
7.2.310.0120.00416.71
7.2.300.0100.00616.71
7.2.290.0070.01016.80
7.2.250.0130.00615.22
7.2.240.0040.01414.97
7.2.230.0130.00614.80
7.2.220.0110.00314.96
7.2.210.0090.00915.32
7.2.200.0060.01015.13
7.2.190.0080.00615.13
7.2.180.0060.00914.98
7.2.170.0110.00015.18
7.2.60.0090.00617.09
7.2.00.0000.01219.51
7.1.330.0000.01515.64
7.1.320.0070.00715.78
7.1.310.0090.00615.82
7.1.300.0120.00315.73
7.1.290.0040.00715.76
7.1.280.0040.01115.61
7.1.270.0030.01015.73
7.1.260.0070.00715.69
7.1.200.0080.00415.53
7.1.100.0060.00618.36
7.1.70.0040.00417.10
7.1.60.0110.01419.46
7.1.50.0100.01316.96
7.1.00.0030.07722.36
7.0.200.0090.00016.43
7.0.140.0030.07322.22
7.0.60.0070.08020.05
7.0.50.0000.04717.88
7.0.40.0130.08320.18
7.0.30.0230.08720.08
7.0.20.0370.06720.12
7.0.10.0070.04720.06
7.0.00.0030.08720.06
5.6.280.0070.07021.03
5.6.210.0130.08320.57
5.6.200.0070.08718.13
5.6.190.0030.07020.33
5.6.180.0130.04320.39
5.6.170.0230.04320.54
5.6.160.0100.08020.51
5.6.150.0100.04018.19
5.6.140.0070.08018.15
5.6.130.0030.04318.16
5.6.120.0030.07321.04
5.6.110.0170.07720.98
5.6.100.0070.04021.05
5.6.90.0200.06721.11
5.6.80.0100.07320.29
5.6.70.3400.03320.35
5.5.350.0230.08020.41
5.5.340.0100.06018.08
5.5.330.0200.05720.21
5.5.320.0170.04320.31
5.5.310.0230.04020.27
5.5.300.0100.08317.98
5.5.290.0070.07718.00
5.5.280.0170.07320.77
5.5.270.0100.08020.82
5.5.260.0130.06320.77
5.5.250.0030.05720.59
5.5.240.4070.03320.37
5.4.450.0630.06319.46
5.4.440.0330.06319.16
5.4.430.0730.05719.36
5.4.420.0870.04719.18
5.4.410.0800.05019.49
5.4.400.0770.05019.01
5.4.390.0030.06019.25
5.4.380.0200.06318.48
5.4.370.0230.06018.57
5.4.360.0230.06018.59
5.4.350.0370.07318.70
5.4.340.0370.07018.76
5.4.320.0050.04212.52
5.4.310.0080.03712.51
5.4.300.0120.03212.51
5.4.290.0060.03812.49
5.4.280.0030.04112.39
5.4.270.0040.04012.39
5.4.260.0060.04012.39
5.4.250.0080.03912.39
5.4.240.0030.03812.39
5.4.230.0060.03712.38
5.4.220.0050.03812.38
5.4.210.0080.03312.39
5.4.200.0030.04412.38
5.4.190.0040.04112.38
5.4.180.0060.03712.38
5.4.170.0060.03612.38
5.4.160.0100.03212.38
5.4.150.0100.03512.38
5.4.140.0060.04112.06
5.4.130.0080.03212.05
5.4.120.0060.03812.01
5.4.110.0060.03712.00
5.4.100.0080.03512.00
5.4.90.0030.04312.00
5.4.80.0050.03912.00
5.4.70.0090.03212.00
5.4.60.0080.03412.00
5.4.50.0060.03612.00
5.4.40.0080.03911.98
5.4.30.0080.03511.98
5.4.20.0070.03611.98
5.4.10.0060.03411.98
5.4.00.0020.04211.47
5.3.290.0070.03712.80
5.3.280.0090.04412.71
5.3.270.0090.04712.72
5.3.260.0100.05312.72
5.3.250.0090.03412.71
5.3.240.0100.03512.72
5.3.230.0060.05312.71
5.3.220.0080.03812.68
5.3.210.0070.03912.68
5.3.200.0100.03512.68
5.3.190.0060.03812.68
5.3.180.0070.03512.67
5.3.170.0060.03612.67
5.3.160.0050.03712.67
5.3.150.0050.04012.68
5.3.140.0070.04112.66
5.3.130.0100.05012.66
5.3.120.0100.05412.66
5.3.110.0090.03712.66
5.3.100.0040.04012.13
5.3.90.0080.04112.11
5.3.80.0050.03912.10
5.3.70.0050.03912.10
5.3.60.0080.03612.08
5.3.50.0070.03712.03
5.3.40.0050.03912.04
5.3.30.0090.03211.99
5.3.20.0040.03811.77
5.3.10.0080.03511.74
5.3.00.0070.04211.73
5.2.170.0060.0329.23
5.2.160.0050.0329.23
5.2.150.0040.0309.23
5.2.140.0030.0329.23
5.2.130.0050.0289.19
5.2.120.0050.0279.19
5.2.110.0050.0299.19
5.2.100.0000.0339.19
5.2.90.0040.0299.19
5.2.80.0030.0329.19
5.2.70.0070.0309.18
5.2.60.0080.0289.14
5.2.50.0040.0329.11
5.2.40.0050.0309.09
5.2.30.0090.0399.06
5.2.20.0040.0319.04
5.2.10.0050.0298.95
5.2.00.0050.0308.82
5.1.60.0060.0228.11
5.1.50.0050.0268.09
5.1.40.0030.0288.07
5.1.30.0080.0258.43
5.1.20.0040.0308.45
5.1.10.0040.0278.18
5.1.00.0050.0278.17
5.0.50.0050.0206.67
5.0.40.0040.0216.52
5.0.30.0040.0356.33
5.0.20.0040.0206.30
5.0.10.0040.0216.28
5.0.00.0060.0326.27
4.4.90.0130.0334.78
4.4.80.0040.0194.75
4.4.70.0040.0214.76
4.4.60.0040.0174.75
4.4.50.0030.0224.77
4.4.40.0020.0344.71
4.4.30.0050.0184.76
4.4.20.0070.0204.84
4.4.10.0050.0224.85
4.4.00.0020.0344.76
4.3.110.0050.0254.66
4.3.100.0060.0194.67
4.3.90.0060.0204.63
4.3.80.0060.0304.59
4.3.70.0030.0224.63
4.3.60.0060.0214.63
4.3.50.0060.0164.63
4.3.40.0040.0274.54
4.3.30.0060.0333.30
4.3.20.0030.0273.28
4.3.10.0050.0173.23
4.3.00.0070.01710.54

preferences:
49.45 ms | 401 KiB | 5 Q