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,25, $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)
5.4.290.0100.07412.51
5.4.280.0080.04612.40
5.4.270.0100.04712.40
5.4.260.0110.05412.41
5.4.250.0100.04912.41
5.4.240.0140.04912.40
5.4.230.0100.04612.39
5.4.220.0090.05112.40
5.4.210.0120.04612.40
5.4.200.0100.05212.40
5.4.190.0080.05212.39
5.4.180.0060.04012.39
5.4.170.0070.03812.40
5.4.160.0060.04012.39
5.4.150.0130.04312.39
5.4.140.0080.03712.08
5.4.130.0080.04112.06
5.4.120.0070.04612.03
5.4.110.0080.04812.02
5.4.100.0130.05812.02
5.4.90.0120.05112.02
5.4.80.0050.05112.02
5.4.70.0080.04112.02
5.4.60.0060.04012.02
5.4.50.0100.04412.02
5.4.40.0090.05012.01
5.4.30.0070.05712.01
5.4.20.0060.05612.00
5.4.10.0080.05212.00
5.4.00.0130.05711.49
5.3.280.0060.06112.71
5.3.270.0090.05912.73
5.3.260.0130.04812.72
5.3.250.0100.04612.71
5.3.240.0060.04912.72
5.3.230.0080.04412.71
5.3.220.0040.04212.68
5.3.210.0060.04312.68
5.3.200.0030.04212.68
5.3.190.0090.03712.68
5.3.180.0070.06012.67
5.3.170.0080.06912.67
5.3.160.0100.06512.67
5.3.150.0090.04812.67
5.3.140.0030.04312.66
5.3.130.0070.04112.66
5.3.120.0090.04112.66
5.3.110.0080.04112.66
5.3.100.0080.04112.13
5.3.90.0060.06112.11
5.3.80.0090.04712.10
5.3.70.0070.05512.10
5.3.60.0170.05912.09
5.3.50.0100.05212.04
5.3.40.0080.05512.04
5.3.30.0090.04612.00
5.3.20.0080.04111.78
5.3.10.0130.07011.74
5.3.00.0250.11511.73

preferences:
136.18 ms | 1394 KiB | 7 Q