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; } } class TestM extends Test { public function run(&$obj){ $obj->secret = "HELLO WORLD"; } } $test = new Test; // start editing here $testM = new TestM; $testM->run($test); // 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.250.0100.05319.04
5.4.240.0170.05318.95
5.4.230.0200.04318.91
5.4.220.0100.05718.91
5.4.210.0270.04318.85
5.4.200.0030.06718.70
5.4.190.0070.05718.91
5.4.180.0100.05019.01
5.4.170.0070.05718.91
5.4.160.0230.06019.07
5.4.150.0130.07318.64
5.4.140.0100.06016.49
5.4.130.0130.05016.41
5.4.120.0230.04016.58
5.4.110.0070.05316.50
5.4.100.0000.06716.48
5.4.90.0170.06716.46
5.4.80.0070.05716.48
5.4.70.0230.04316.52
5.4.60.0100.05716.56
5.4.50.0100.06716.45
5.4.40.0100.04716.33
5.4.30.0070.07316.58
5.4.20.0130.07016.43
5.4.10.0130.05316.46
5.4.00.0130.05315.93
5.3.280.0130.07014.70
5.3.270.0130.07314.79
5.3.260.0130.05314.79
5.3.250.0070.05314.79
5.3.240.0130.05014.68
5.3.230.0030.06314.64
5.3.220.0070.05314.48
5.3.210.0030.06014.48
5.3.200.0030.06314.71
5.3.190.0100.06314.66
5.3.180.0200.04014.66
5.3.170.0100.05014.56
5.3.160.0230.05314.66
5.3.150.0100.07314.66
5.3.140.0030.06314.39
5.3.130.0030.06314.62
5.3.120.0130.07314.64
5.3.110.0100.05714.48
5.3.100.0130.06014.26
5.3.90.0070.07014.01
5.3.80.0100.04314.24
5.3.70.0130.04714.25
5.3.60.0130.06014.09
5.3.50.0100.05013.94
5.3.40.0100.05013.94
5.3.30.0170.03713.98
5.3.20.0100.04713.79
5.3.10.0130.05713.76
5.3.00.0030.06713.73

preferences:
138.79 ms | 1398 KiB | 7 Q