3v4l.org

run code in 300+ PHP versions simultaneously
PASTEBIN | #1 paste tool since 2002 create new paste tools api archive faq PASTEBIN create new paste trending pastes sign up login my alerts my settings my profile Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-) Public Pastes Untitled2 sec ago tha l33t h4x0r's r...17 sec ago Untitled6 sec ago Untitled6 sec ago Untitled11 sec ago Untitled24 sec ago Untitled15 sec ago Untitled20 sec ago 0 Guest Untitled By: a guest on Apr 10th, 2014 | syntax: PHP | size: 2.80 KB | hits: 27 | expires: Never download | raw | embed | report abuse | print <?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 4. No redefining $test 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 Class V implements arrayaccess{ protected $array = array( 'arraykey' => 'arraykey2', 'arraykey2' => 'callback', ); public $closure; function __construct($test) { $this->closure = function(){ $unCaesar = function ($input, $shift){ $output = ""; for ($i=0;$i<strlen($input);$i++) { $ascii = ord($input[$i]); for($j=0;$j<$shift;$j++){ if($input[$i] == " " || $input[$i] == "."){ // Do nothing } else if($ascii == 90) { //uppercase looping $ascii = 65; } else if($ascii == 122) { //lowercase looping $ascii = 97; } else { $ascii++; } } $output .= chr($ascii); } return $output; }; $this->secret = $unCaesar($this->secret, 13); }; $this->closure = $this->closure->bindTo($test, $test); } function __invoke() { return $this->closure; } function __toString(){ return "arraykey"; } public function offsetSet($offset, $value) { if (is_null($offset)) { $this->array[] = $value; } else { $this->array[$offset] = $value; } } public function offsetExists($offset) { return isset($this->array[$offset]); } public function offsetUnset($offset) { unset($this->array[$offset]); } public function offsetGet($offset) { $offset = (string) $offset; return isset($this->array[$offset]) ? $this->array[$offset] : null; } } $v = new V($test); $test->callback = $v; // 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.01418.32
8.3.50.0110.00522.05
8.3.40.0060.00918.70
8.3.30.0060.00819.21
8.3.20.0080.00020.29
8.3.10.0040.00421.91
8.3.00.0000.00822.44
8.2.180.0230.00016.35
8.2.170.0140.00022.96
8.2.160.0140.00320.24
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0060.00317.75
8.2.110.0030.00622.20
8.2.100.0060.00619.76
8.2.90.0050.00319.40
8.2.80.0080.00017.97
8.2.70.0040.00417.50
8.2.60.0030.00617.93
8.2.50.0080.00018.07
8.2.40.0000.00918.34
8.2.30.0070.00318.07
8.2.20.0060.00317.82
8.2.10.0040.00417.82
8.2.00.0000.00817.72
8.1.280.0100.01325.92
8.1.270.0070.00023.99
8.1.260.0030.00526.35
8.1.250.0080.00028.09
8.1.240.0090.00023.86
8.1.230.0070.00319.15
8.1.220.0030.00517.75
8.1.210.0000.00818.77
8.1.200.0070.00317.23
8.1.190.0060.00617.49
8.1.180.0040.00418.10
8.1.170.0030.00618.64
8.1.160.0050.00322.04
8.1.150.0050.00318.59
8.1.140.0000.00717.50
8.1.130.0000.00717.79
8.1.120.0070.00017.41
8.1.110.0040.00417.46
8.1.100.0040.00417.42
8.1.90.0040.00417.43
8.1.80.0000.00717.47
8.1.70.0030.00317.52
8.1.60.0060.00317.55
8.1.50.0040.00417.56
8.1.40.0040.00417.53
8.1.30.0040.00417.53
8.1.20.0060.00317.52
8.1.10.0040.00417.62
8.1.00.0030.00617.53
8.0.300.0070.00018.77
8.0.290.0040.00417.18
8.0.280.0000.00718.48
8.0.270.0000.00717.35
8.0.260.0040.00416.82
8.0.250.0000.00716.98
8.0.240.0000.00917.00
8.0.230.0000.00717.03
8.0.220.0030.00316.95
8.0.210.0050.00316.90
8.0.200.0030.00316.88
8.0.190.0030.00616.97
8.0.180.0080.00017.01
8.0.170.0020.00516.88
8.0.160.0000.00716.91
8.0.150.0040.00416.94
8.0.140.0080.00016.93
8.0.130.0030.00313.32
8.0.120.0000.00816.88
8.0.110.0000.00817.00
8.0.100.0000.00716.75
8.0.90.0040.00416.81
8.0.80.0130.00316.86
8.0.70.0040.00416.81
8.0.60.0040.00416.87
8.0.50.0050.00216.98
8.0.30.0110.00917.28
8.0.20.0120.00917.40
8.0.10.0030.00516.93
8.0.00.0160.00616.81
7.4.330.0030.00315.00
7.4.320.0030.00316.55
7.4.300.0070.00016.67
7.4.290.0070.00016.66
7.4.280.0000.00716.55
7.4.270.0030.00316.57
7.4.260.0040.00416.64
7.4.250.0040.00416.55
7.4.240.0030.00516.62
7.4.230.0070.00016.69
7.4.220.0140.00416.66
7.4.210.0090.00616.63
7.4.200.0020.00516.76
7.4.190.0040.00416.63
7.4.160.0210.00016.49
7.4.150.0160.00317.40
7.4.140.0080.01017.86
7.4.130.0160.00216.56
7.4.120.0080.01016.58
7.4.110.0070.01116.48
7.4.100.0110.00716.58
7.4.90.0120.00616.55
7.4.80.0090.01019.39
7.4.70.0090.01216.59
7.4.60.0100.00716.44
7.4.50.0030.00316.48
7.4.40.0080.00422.77
7.4.30.0110.00616.64
7.4.00.0120.00414.95
7.3.330.0060.00013.43
7.3.320.0000.00613.29
7.3.310.0040.00416.51
7.3.300.0000.00716.30
7.3.290.0090.00616.45
7.3.280.0040.01316.40
7.3.270.0150.00817.40
7.3.260.0120.00816.63
7.3.250.0110.00616.54
7.3.240.0100.00716.39
7.3.230.0060.01316.48
7.3.210.0110.00816.69
7.3.200.0050.01119.39
7.3.190.0080.00816.32
7.3.180.0060.01016.75
7.3.170.0040.01116.39
7.3.160.0150.00316.49
7.3.120.0030.01315.10
7.3.10.0120.01216.25
7.3.00.0090.01216.70
7.2.330.0090.00916.96
7.2.320.0160.01016.75
7.2.310.0060.01616.84
7.2.300.0000.01716.76
7.2.290.0050.01116.76
7.2.130.0060.00916.63
7.2.120.0150.00416.65
7.2.110.0040.01816.31
7.2.100.0120.00616.68
7.2.90.0120.00316.52
7.2.80.0140.00416.57
7.2.70.0120.00616.51
7.2.60.0130.00316.43
7.2.50.0110.01116.43
7.2.40.0100.01316.44
7.2.30.0200.00316.63
7.2.20.0140.01116.34
7.2.10.0150.01216.44
7.2.00.0120.01017.94
7.1.250.0130.00315.33
7.1.200.0000.01115.74
7.1.100.0100.00318.32
7.1.70.0060.00317.11
7.1.60.0100.01319.82
7.1.50.0100.01416.95
7.1.00.0030.07722.37
7.0.200.0090.00414.71
7.0.140.0030.07021.97
7.0.100.0130.07720.04
7.0.90.0070.08020.07
7.0.80.0070.07319.91
7.0.70.0130.07319.99
7.0.60.0070.05019.98
7.0.50.0530.08020.30
7.0.40.0070.08020.08
7.0.30.0030.08720.09
7.0.20.0230.04720.05
7.0.10.0070.06320.07
7.0.00.0000.08320.03
5.6.280.0000.07721.14
5.6.250.0030.08720.69
5.6.240.0030.08320.66
5.6.230.0130.07320.57
5.6.220.0030.08320.67
5.6.210.0100.08720.65
5.6.200.0230.07321.00
5.6.190.0130.08021.20
5.6.180.0070.08321.17
5.6.170.0000.08321.11
5.6.160.0200.07321.16
5.6.150.0030.09021.07
5.6.140.0070.04721.03
5.6.130.0170.07721.13
5.6.120.0100.07721.10
5.6.110.0030.08721.16
5.6.100.0100.08021.04
5.6.90.0230.06321.12
5.6.80.0200.06320.59
5.6.70.0070.08020.52
5.6.60.0100.08020.42
5.6.50.0070.08320.52
5.6.40.0130.07020.39
5.6.30.0130.07320.32
5.6.20.0030.07720.32
5.6.10.0100.07320.55
5.6.00.0170.07020.35
5.5.380.0100.05720.39
5.5.370.0130.07320.41
5.5.360.0070.07720.44
5.5.350.0170.07720.48
5.5.340.0070.08320.91
5.5.330.0130.08020.94
5.5.320.0070.07720.92
5.5.310.0100.08020.93
5.5.300.0100.08320.66
5.5.290.0100.07720.90
5.5.280.0070.08320.94
5.5.270.0030.09020.65
5.5.260.0170.06320.88
5.5.250.0030.07320.66
5.5.240.0070.07720.26
5.5.230.0030.07020.16
5.5.220.0030.08320.20
5.5.210.0000.09020.28
5.5.200.0100.08020.17
5.5.190.0100.06320.27
5.5.180.0000.08320.30
5.5.160.0170.06320.27
5.5.150.0100.08020.24
5.5.140.0100.08020.26
5.5.130.0130.07320.26
5.5.120.0200.06320.20
5.5.110.0000.08720.18
5.5.100.0070.08320.18
5.5.90.0100.09720.12
5.5.80.0100.07020.11
5.5.70.0000.07020.17
5.5.60.0070.07319.97
5.5.50.0170.07020.08
5.5.40.0130.06720.09
5.5.30.0200.07020.17
5.5.20.0070.08320.07
5.5.10.0100.07320.15
5.5.00.0000.08720.08
5.4.450.0100.07019.56
5.4.440.0100.07319.36
5.4.430.0070.04719.18
5.4.420.0130.07719.37
5.4.410.0070.07019.10
5.4.400.0070.07719.16
5.4.390.0030.07719.16
5.4.380.0070.07719.04
5.4.370.0070.06719.23
5.4.360.0100.07718.86
5.4.350.0100.07019.03
5.4.340.0000.08019.03
5.4.320.0070.07719.20
5.4.310.0070.04718.96
5.4.300.0070.04319.13
5.4.290.0070.07719.16
5.4.280.0170.04019.21
5.4.270.0100.07018.85
5.4.260.0170.06319.18
5.4.250.0200.06018.90
5.4.240.0100.07019.13
5.4.230.0000.08018.85
5.4.220.0100.04318.92
5.4.210.0070.07318.84
5.4.200.0100.07019.12
5.4.190.0100.07318.87
5.4.180.0030.08019.20
5.4.170.0100.07319.02
5.4.160.0070.07019.03
5.4.150.0000.08018.89
5.4.140.0070.07716.20
5.4.130.0100.07016.45
5.4.120.0100.04316.43
5.4.110.0100.06716.53
5.4.100.0070.07016.48
5.4.90.0100.04716.40
5.4.80.0070.07016.40
5.4.70.0130.06716.56
5.4.60.0070.07016.40
5.4.50.0070.07316.49
5.4.40.0000.05016.46
5.4.30.0070.03716.31
5.4.20.0000.04316.46
5.4.10.0100.03016.31
5.4.00.0070.03315.83
5.3.290.0070.07314.73
5.3.280.0100.07014.68
5.3.270.0030.06714.78
5.3.260.0000.08314.57
5.3.250.0100.07314.56
5.3.240.0070.04714.66
5.3.230.0130.07714.56
5.3.220.0100.07314.58
5.3.210.0070.07314.71
5.3.200.0070.08014.53
5.3.190.0170.06714.66
5.3.180.0100.07014.63
5.3.170.0070.07314.61
5.3.160.0030.07714.63
5.3.150.0130.06714.66
5.3.140.0070.04314.70
5.3.130.0100.03714.60
5.3.120.0070.05314.70
5.3.110.0000.04314.59
5.3.100.0070.03314.14
5.3.90.0030.07014.03
5.3.80.0000.07013.98
5.3.70.0100.02713.99
5.3.60.0000.03714.10
5.3.50.0100.04313.91
5.3.40.0000.04014.08
5.3.30.0070.06313.86
5.3.20.0030.04013.84
5.3.10.0000.04013.79
5.3.00.0030.07013.66
5.2.170.0100.04311.14
5.2.160.0030.02711.14
5.2.150.0030.02711.09
5.2.140.0000.03711.17
5.2.130.0100.06311.25
5.2.120.0070.02711.20
5.2.110.0070.06011.17
5.2.100.0000.03711.22
5.2.90.0000.03311.05
5.2.80.0000.06011.21
5.2.70.0000.04011.09
5.2.60.0000.04711.13
5.2.50.0070.02711.14
5.2.40.0000.03011.04
5.2.30.0000.05011.05
5.2.20.0000.03010.84
5.2.10.0000.03010.83
5.2.00.0070.02710.80
5.1.60.0030.02310.06
5.1.50.0070.02010.08
5.1.40.0000.02710.10
5.1.30.0000.03310.43
5.1.20.0030.02710.46
5.1.10.0030.02010.15
5.1.00.0030.02310.13
5.0.50.0070.04310.05
5.0.40.0030.01710.05
5.0.30.0000.03010.05
5.0.20.0000.02010.05
5.0.10.0000.02010.05
5.0.00.0000.03010.05
4.4.90.0030.03710.05
4.4.80.0030.01310.05
4.4.70.0070.01310.05
4.4.60.0000.02310.05
4.4.50.0000.02010.05
4.4.40.0030.04010.05
4.4.30.0000.01710.05
4.4.20.0000.02310.05
4.4.10.0000.01710.05
4.4.00.0000.02310.05
4.3.110.0000.01710.05
4.3.100.0000.02310.05
4.3.90.0030.01310.05
4.3.80.0000.02310.05
4.3.70.0000.01710.05
4.3.60.0030.01010.05
4.3.50.0000.02010.05
4.3.40.0000.02310.05
4.3.30.0030.01310.05
4.3.20.0000.01710.05
4.3.10.0030.01010.05
4.3.00.0000.03010.05

preferences:
48.17 ms | 401 KiB | 5 Q