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:::::'.$k); $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.0070.00716.88
8.3.50.0090.00722.00
8.3.40.0140.00418.70
8.3.30.0110.00418.83
8.3.20.0000.00720.21
8.3.10.0050.00223.65
8.3.00.0070.00319.38
8.2.180.0100.01318.66
8.2.170.0070.00722.96
8.2.160.0030.01020.35
8.2.150.0000.00724.18
8.2.140.0040.00424.66
8.2.130.0050.00326.16
8.2.120.0050.00322.24
8.2.110.0060.00320.56
8.2.100.0080.00417.91
8.2.90.0000.00817.75
8.2.80.0050.00318.92
8.2.70.0050.00317.75
8.2.60.0080.00017.63
8.2.50.0060.00317.75
8.2.40.0040.00417.75
8.2.30.0000.00718.21
8.2.20.0080.00017.74
8.2.10.0040.00418.12
8.2.00.0000.01017.78
8.1.280.0070.00725.92
8.1.270.0040.00423.96
8.1.260.0000.00726.35
8.1.250.0000.00728.09
8.1.240.0030.00623.81
8.1.230.0040.00722.08
8.1.220.0050.00317.74
8.1.210.0030.00518.77
8.1.200.0090.00017.36
8.1.190.0040.00417.35
8.1.180.0000.00818.10
8.1.170.0060.00318.46
8.1.160.0070.00022.03
8.1.150.0030.00718.72
8.1.140.0040.00417.48
8.1.130.0000.00917.79
8.1.120.0000.00717.46
8.1.110.0040.00417.52
8.1.100.0000.00717.47
8.1.90.0040.00417.38
8.1.80.0000.00717.31
8.1.70.0050.00217.42
8.1.60.0030.00517.61
8.1.50.0050.00317.58
8.1.40.0000.00717.48
8.1.30.0040.00417.53
8.1.20.0040.00417.58
8.1.10.0030.00617.50
8.1.00.0030.00617.42
8.0.300.0080.00018.77
8.0.290.0040.00416.75
8.0.280.0000.00718.34
8.0.270.0050.00217.27
8.0.260.0000.00718.43
8.0.250.0000.00717.09
8.0.240.0040.00416.93
8.0.230.0030.00317.07
8.0.220.0060.00016.99
8.0.210.0000.00716.96
8.0.200.0070.00016.98
8.0.190.0070.00016.90
8.0.180.0030.00517.01
8.0.170.0050.00317.02
8.0.160.0050.00317.07
8.0.150.0040.00416.91
8.0.140.0040.00416.95
8.0.130.0050.00013.37
8.0.120.0000.00816.94
8.0.110.0040.00416.86
8.0.100.0030.00616.96
8.0.90.0030.00616.81
8.0.80.0130.00317.03
8.0.70.0020.00516.85
8.0.60.0000.00717.02
8.0.50.0070.00016.87
8.0.30.0080.01117.29
8.0.20.0090.00917.40
8.0.10.0030.00517.10
8.0.00.0030.01816.81
7.4.330.0000.00515.04
7.4.320.0070.00016.39
7.4.300.0000.00716.54
7.4.290.0000.00716.43
7.4.280.0070.00016.52
7.4.270.0000.00716.55
7.4.260.0030.00316.52
7.4.250.0040.00416.63
7.4.240.0040.00416.58
7.4.230.0000.00716.66
7.4.220.0070.01116.52
7.4.210.0080.00816.70
7.4.200.0080.00016.46
7.4.190.0030.00316.80
7.4.160.0130.00716.62
7.4.150.0110.00717.40
7.4.140.0120.00917.86
7.4.130.0070.01216.60
7.4.120.0110.00816.51
7.4.110.0130.00416.55
7.4.100.0120.00616.44
7.4.90.0060.01316.52
7.4.80.0080.01219.39
7.4.70.0150.00316.60
7.4.60.0180.00616.61
7.4.50.0030.00616.61
7.4.40.0070.00722.77
7.4.30.0140.00316.40
7.4.10.0070.01314.83
7.4.00.0030.01415.02
7.3.330.0050.00013.32
7.3.320.0000.00713.22
7.3.310.0000.00716.50
7.3.300.0000.00716.38
7.3.290.0100.00316.46
7.3.280.0090.00616.41
7.3.270.0110.00617.40
7.3.260.0080.00816.51
7.3.250.0110.00616.68
7.3.240.0210.00016.58
7.3.230.0110.00516.41
7.3.210.0090.00916.53
7.3.200.0090.00616.66
7.3.190.0170.00616.54
7.3.180.0090.00616.52
7.3.170.0080.00816.38
7.3.160.0080.01216.48
7.3.130.0100.01014.80
7.3.120.0110.00714.86
7.3.110.0070.00714.82
7.3.100.0060.00615.01
7.3.90.0080.00615.01
7.3.80.0040.01215.03
7.3.70.0080.00814.86
7.3.60.0060.00914.95
7.3.50.0070.00714.81
7.3.40.0020.01314.76
7.3.30.0030.00914.94
7.3.20.0080.00316.74
7.3.10.0040.01116.56
7.3.00.0080.00516.55
7.2.330.0130.00416.57
7.2.320.0040.01416.84
7.2.310.0060.01016.78
7.2.300.0100.01016.86
7.2.290.0060.01216.53
7.2.260.0110.00414.84
7.2.250.0110.00715.14
7.2.240.0040.01314.97
7.2.230.0070.00915.16
7.2.220.0070.00914.99
7.2.210.0040.01415.08
7.2.200.0070.01015.09
7.2.190.0110.00515.10
7.2.180.0040.01015.01
7.2.170.0070.00914.96
7.2.160.0050.00815.20
7.2.150.0030.01417.06
7.2.140.0070.01016.87
7.2.130.0050.00816.74
7.2.120.0060.00716.77
7.2.110.0040.01116.78
7.2.100.0070.00716.84
7.2.90.0090.00816.87
7.2.80.0100.00616.82
7.2.70.0070.00816.82
7.2.60.0050.00816.84
7.2.50.0100.00617.01
7.2.40.0050.00816.87
7.2.30.0110.00816.85
7.2.20.0080.00616.88
7.2.10.0090.00716.84
7.2.00.0110.00817.49
7.1.330.0060.00815.73
7.1.320.0020.00915.71
7.1.310.0090.00915.74
7.1.300.0080.00615.82
7.1.290.0050.00715.81
7.1.280.0070.01015.61
7.1.270.0050.01115.69
7.1.260.0040.01115.85
7.1.250.0020.01215.80
7.1.240.0060.00615.86
7.1.230.0090.00615.67
7.1.220.0040.00415.45
7.1.210.0030.01415.89
7.1.200.0040.01115.93
7.1.190.0040.00415.97
7.1.180.0080.00015.91
7.1.170.0080.00415.97
7.1.160.0100.00715.98
7.1.150.0040.01115.75
7.1.140.0030.01015.91
7.1.130.0100.00715.95
7.1.120.0060.00915.82
7.1.110.0040.01115.72
7.1.100.0050.00916.76
7.1.90.0040.00915.82
7.1.80.0030.00915.95
7.1.70.0040.00616.58
7.1.60.0080.01017.65
7.1.50.0040.01016.29
7.1.40.0060.00915.66
7.1.30.0000.01315.60
7.1.20.0030.01215.87
7.1.10.0000.01615.50
7.1.00.0050.03919.17
7.0.330.0060.00315.42
7.0.320.0000.00815.25
7.0.310.0030.01615.61
7.0.300.0060.00615.47
7.0.290.0060.00315.22
7.0.280.0060.00615.41
7.0.270.0040.01115.64
7.0.260.0060.00315.18
7.0.250.0030.01315.59
7.0.240.0060.00615.18
7.0.230.0030.00715.54
7.0.220.0070.00715.39
7.0.210.0130.00315.46
7.0.200.0050.00416.15
7.0.190.0000.01415.55
7.0.180.0000.01515.52
7.0.170.0070.00315.57
7.0.160.0030.00615.57
7.0.150.0100.00315.24
7.0.140.0050.04018.71
7.0.130.0070.00315.30
7.0.120.0090.00315.71
7.0.110.0030.00615.54
7.0.100.0030.01015.48
7.0.90.0110.00415.55
7.0.80.0000.00815.48
7.0.70.0060.00615.47
7.0.60.0050.03817.77
7.0.50.0020.02716.57
7.0.40.0050.02416.92
7.0.30.0170.02216.88
7.0.20.0140.02616.77
7.0.10.0050.02616.87
7.0.00.0050.04616.82
5.6.400.0140.00414.70
5.6.390.0030.01014.63
5.6.380.0000.01314.66
5.6.370.0040.00814.48
5.6.360.0090.00914.83
5.6.350.0040.00814.66
5.6.340.0040.00814.69
5.6.330.0030.00614.66
5.6.320.0030.01014.67
5.6.310.0000.01114.50
5.6.300.0030.00514.60
5.6.290.0000.00914.34
5.6.280.0090.03717.68
5.6.270.0070.00314.61
5.6.260.0030.00714.47
5.6.250.0000.01014.60
5.6.240.0040.00814.57
5.6.230.0050.00514.42
5.6.220.0000.01014.58
5.6.210.0060.04417.56
5.6.200.0070.04216.39
5.6.190.0030.03017.53
5.6.180.0160.02517.52
5.6.170.0160.03317.42
5.6.160.0130.03917.40
5.6.150.0090.04516.29
5.6.140.0090.02216.25
5.6.130.0030.04716.21
5.6.120.0140.04017.79
5.6.110.0070.04517.73
5.6.100.0050.04617.69
5.6.90.0080.04417.67
5.6.80.0050.03517.49
5.6.70.2180.02317.46
5.6.60.0060.00614.44
5.6.50.0060.00614.48
5.6.40.0000.01114.34
5.6.30.0070.00714.52
5.6.20.0030.01114.47
5.6.10.0080.00814.45
5.6.00.0000.01414.49
5.5.380.0060.00314.52
5.5.370.0060.00914.34
5.5.360.0000.00814.30
5.5.350.0200.04017.47
5.5.340.0030.04716.25
5.5.330.0070.03217.39
5.5.320.0130.02817.21
5.5.310.0070.03417.40
5.5.300.0070.03216.16
5.5.290.0050.02616.12
5.5.280.0120.04017.61
5.5.270.0100.02517.64
5.5.260.0100.02717.70
5.5.250.0050.03517.54
5.5.240.1870.02217.35
5.5.230.0030.01014.45
5.5.220.0030.01014.24
5.5.210.0000.01114.09
5.5.200.0000.01214.50
5.5.190.0040.00414.23
5.5.180.0030.00714.46
5.5.170.0060.00614.49
5.5.160.0100.00714.39
5.5.150.0060.00614.38
5.5.140.0060.00914.61
5.5.130.0030.00914.08
5.5.120.0030.00714.42
5.5.110.0100.00314.51
5.5.100.0110.00314.20
5.5.90.0100.00314.55
5.5.80.0000.01313.92
5.5.70.0000.00913.91
5.5.60.0030.01114.47
5.5.50.0030.00914.00
5.5.40.0070.00714.42
5.5.30.0120.00313.90
5.5.20.0000.00814.27
5.5.10.0030.00714.13
5.5.00.0120.00314.12
5.4.450.0350.03015.24
5.4.440.0280.03515.41
5.4.430.0140.03115.47
5.4.420.0400.03315.31
5.4.410.0380.02715.24
5.4.400.0400.02915.07
5.4.390.0320.02815.01
5.4.380.0210.02915.09
5.4.370.0180.03014.94
5.4.360.0200.02514.76
5.4.350.0210.02814.92
5.4.340.0180.03214.88
5.4.330.0060.00311.12
5.4.320.0080.02211.72
5.4.310.0040.02411.85
5.4.300.0020.02611.88
5.4.290.0040.02411.76
5.4.280.0050.02011.85
5.4.270.0060.01911.68
5.4.260.0020.02611.79
5.4.250.0040.02211.81
5.4.240.0040.03211.74
5.4.230.0090.02711.83
5.4.220.0050.02811.73
5.4.210.0060.02211.56
5.4.200.0060.02411.60
5.4.190.0050.02111.75
5.4.180.0050.02611.85
5.4.170.0070.02711.88
5.4.160.0050.02211.86
5.4.150.0070.02011.88
5.4.140.0040.02911.65
5.4.130.0070.02711.51
5.4.120.0050.02711.52
5.4.110.0050.02111.52
5.4.100.0050.02311.59
5.4.90.0070.02111.59
5.4.80.0070.02011.66
5.4.70.0070.02211.55
5.4.60.0040.02211.63
5.4.50.0060.02111.67
5.4.40.0060.02211.68
5.4.30.0050.02211.53
5.4.20.0070.02111.54
5.4.10.0050.02011.54
5.4.00.0070.02511.14
5.3.290.0080.02411.77
5.3.280.0020.02411.56
5.3.270.0040.02311.73
5.3.260.0060.03011.68
5.3.250.0090.02511.71
5.3.240.0030.02511.64
5.3.230.0040.02311.72
5.3.220.0030.02611.66
5.3.210.0060.02811.67
5.3.200.0070.02011.54
5.3.190.0040.02311.53
5.3.180.0050.02511.68
5.3.170.0030.02511.72
5.3.160.0040.02111.74
5.3.150.0040.02411.75
5.3.140.0060.02011.69
5.3.130.0090.02211.59
5.3.120.0060.02311.70
5.3.110.0040.02311.72
5.3.100.0040.02411.29
5.3.90.0050.02211.43
5.3.80.0050.02211.38
5.3.70.0040.02311.21
5.3.60.0060.02311.23
5.3.50.0070.01911.35
5.3.40.0050.02211.34
5.3.30.0040.02011.34
5.3.20.0050.02011.07
5.3.10.0070.01911.10
5.3.00.0050.02311.04
5.2.170.0040.0339.24
5.2.160.0070.0309.23
5.2.150.0040.0409.23
5.2.140.0060.0339.23
5.2.130.0040.0319.19
5.2.120.0060.0289.19
5.2.110.0040.0309.20
5.2.100.0050.0299.20
5.2.90.0060.0279.19
5.2.80.0050.0309.19
5.2.70.0050.0309.19
5.2.60.0030.0339.14
5.2.50.0040.0319.11
5.2.40.0080.0289.09
5.2.30.0050.0319.06
5.2.20.0060.0349.05
5.2.10.0060.0368.95
5.2.00.0070.0308.82
5.1.60.0030.0278.10
5.1.50.0050.0258.10
5.1.40.0060.0258.08
5.1.30.0030.0278.43
5.1.20.0040.0268.45
5.1.10.0050.0258.18
5.1.00.0050.0248.18
5.0.50.0050.0196.66
5.0.40.0040.0256.52
5.0.30.0030.0336.34
5.0.20.0080.0236.30
5.0.10.0020.0316.29
5.0.00.0030.0316.27
4.4.90.0050.0134.77
4.4.80.0010.0184.75
4.4.70.0040.0164.75
4.4.60.0030.0154.76
4.4.50.0030.0234.77
4.4.40.0050.0234.71
4.4.30.0020.0164.76
4.4.20.0030.0154.84
4.4.10.0010.0174.85
4.4.00.0000.0284.76
4.3.110.0050.0164.67
4.3.100.0030.0174.66
4.3.90.0040.0164.63
4.3.80.0020.0274.59
4.3.70.0060.0144.63
4.3.60.0020.0154.62
4.3.50.0040.0164.63
4.3.40.0050.0234.54
4.3.30.0010.0173.30
4.3.20.0060.0133.28
4.3.10.0040.0153.24
4.3.00.0070.01310.54

preferences:
48.3 ms | 401 KiB | 5 Q