3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* Challenge 1: Read and write to 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; public $testy; 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 $this->testy = $key; $value = $v(); // and a callback! $this->{$key} = $value; } } $test = new Test; // start editing here class Intercept { public function getKey($test) { $array = (array) $test; reset($array); $first_key = key($array); print_r($array[$first_key]); $blah = array(); $test->__set($array[$first_key] , $blah[0]['blah']); /* foreach($array as $k => $v) { print_r($k); print_r($v); } */ } } $intercept = new Intercept; $intercept->getKey($test); // end editing here echo $test->run(); print_r($test->testy);die();

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.0090.01516.63
8.3.50.0140.00221.98
8.3.40.0070.01318.71
8.3.30.0140.00019.20
8.3.20.0140.00020.21
8.3.10.0000.00823.56
8.3.00.0050.00319.51
8.2.180.0090.00918.29
8.2.170.0070.00722.96
8.2.160.0100.00320.50
8.2.150.0050.00324.18
8.2.140.0070.00024.66
8.2.130.0040.00426.16
8.2.120.0000.00722.11
8.2.110.0060.00322.27
8.2.100.0120.00018.03
8.2.90.0040.00419.09
8.2.80.0050.00317.97
8.2.70.0050.00317.75
8.2.60.0000.00818.04
8.2.50.0030.00618.07
8.2.40.0080.00019.94
8.2.30.0030.00618.09
8.2.20.0070.00017.65
8.2.10.0040.00418.14
8.2.00.0000.01017.79
8.1.280.0200.00025.92
8.1.270.0130.00622.19
8.1.260.0030.00526.35
8.1.250.0040.00428.09
8.1.240.0040.00723.84
8.1.230.0080.00419.01
8.1.220.0060.00317.74
8.1.210.0030.00518.77
8.1.200.0060.00317.23
8.1.190.0040.00417.63
8.1.180.0050.00518.10
8.1.170.0040.00818.49
8.1.160.0080.00021.90
8.1.150.0000.01018.61
8.1.140.0040.00417.29
8.1.130.0030.00317.86
8.1.120.0070.00017.47
8.1.110.0080.00317.39
8.1.100.0050.00217.46
8.1.90.0070.00017.43
8.1.80.0040.00417.33
8.1.70.0000.00717.41
8.1.60.0050.00317.50
8.1.50.0080.00017.46
8.1.40.0030.00617.51
8.1.30.0000.00817.54
8.1.20.0040.00417.74
8.1.10.0000.00817.51
8.1.00.0060.00317.52
8.0.300.0000.00718.77
8.0.290.0040.00417.04
8.0.280.0000.00818.41
8.0.270.0000.00717.27
8.0.260.0070.00017.28
8.0.250.0030.00316.98
8.0.240.0030.00316.94
8.0.230.0030.00316.95
8.0.220.0000.00716.91
8.0.210.0030.00716.85
8.0.200.0000.00816.94
8.0.190.0040.00417.00
8.0.180.0040.00416.97
8.0.170.0040.00416.92
8.0.160.0000.00816.86
8.0.150.0000.00816.79
8.0.140.0000.00716.88
8.0.130.0050.00013.36
8.0.120.0040.00416.89
8.0.110.0000.00816.80
8.0.100.0000.00716.87
8.0.90.0040.00416.92
8.0.80.0110.00716.81
8.0.70.0040.00416.99
8.0.60.0030.00616.91
8.0.50.0030.00516.88
8.0.30.0130.01017.21
8.0.20.0120.00717.40
8.0.10.0000.00717.09
8.0.00.0110.00816.73
7.4.330.0000.00515.00
7.4.320.0030.00316.59
7.4.300.0000.00616.45
7.4.290.0000.00716.55
7.4.280.0000.00716.63
7.4.270.0040.00316.44
7.4.260.0070.00016.51
7.4.250.0050.00216.51
7.4.240.0080.00016.57
7.4.230.0000.00716.36
7.4.220.0090.00916.74
7.4.210.0080.00616.62
7.4.200.0000.00716.42
7.4.190.0000.00716.81
7.4.160.0070.01016.64
7.4.150.0140.00717.40
7.4.140.0070.01117.86
7.4.130.0050.01216.55
7.4.120.0100.00816.71
7.4.110.0060.01116.67
7.4.100.0080.01116.72
7.4.90.0140.00416.69
7.4.80.0140.00819.39
7.4.70.0120.01216.66
7.4.60.0120.00916.65
7.4.50.0080.00016.48
7.4.40.0100.00622.77
7.4.30.0030.01316.57
7.4.00.0070.00715.23
7.3.330.0030.00313.32
7.3.320.0050.00013.25
7.3.310.0070.00016.30
7.3.300.0000.00816.45
7.3.290.0030.01016.46
7.3.280.0100.00816.44
7.3.270.0090.00917.40
7.3.260.0090.00916.54
7.3.250.0130.00816.49
7.3.240.0130.01016.61
7.3.230.0140.00316.41
7.3.210.0090.00916.54
7.3.200.0090.00319.39
7.3.190.0120.00916.51
7.3.180.0090.00616.43
7.3.170.0120.00816.52
7.3.160.0070.01316.42
7.3.120.0130.00314.94
7.2.330.0070.01016.80
7.2.320.0070.01416.46
7.2.310.0200.00316.78
7.2.300.0120.00816.81
7.2.290.0100.00616.53
7.2.60.0040.00816.79
7.1.200.0040.00815.64
7.1.70.0060.00317.13
7.1.60.0090.00319.46
7.1.50.0090.00916.80
7.1.00.0070.07322.43
7.0.200.0000.00816.79
7.0.140.0000.07722.11
7.0.60.0170.05319.90
7.0.50.0070.04017.88
7.0.40.0170.07720.05
7.0.30.0430.04020.30
7.0.20.0330.07320.16
7.0.10.0070.07020.26
7.0.00.0070.05320.11
5.6.280.0070.07020.99
5.6.210.0070.05020.71
5.6.200.0070.03718.16
5.6.190.0100.07320.52
5.6.180.0230.03720.61
5.6.170.0330.08320.55
5.6.160.0030.09020.39
5.6.150.0000.04718.19
5.6.140.0030.08018.27
5.6.130.0100.04718.24
5.6.120.0100.08721.10
5.6.110.0200.07321.00
5.6.100.0100.03320.89
5.6.90.0170.07021.04
5.6.80.0030.07720.41
5.6.70.4430.04720.38
5.5.350.0270.06020.41
5.5.340.0070.03317.99
5.5.330.0100.06320.35
5.5.320.0330.06320.35
5.5.310.0330.07720.19
5.5.300.0000.09017.95
5.5.290.0130.06017.97
5.5.280.0070.08720.89
5.5.270.0100.08020.86
5.5.260.0030.09720.68
5.5.250.0070.06720.70
5.5.240.0300.07020.04
5.4.450.0970.07319.32
5.4.440.0700.07019.52
5.4.430.0130.05719.62
5.4.420.0300.06319.61
5.4.410.0970.05719.55
5.4.400.0100.05319.01
5.4.390.0630.06719.16
5.4.380.0330.07318.63
5.4.370.0330.05018.70
5.4.360.0300.05718.75
5.4.350.0330.07718.51
5.4.340.0600.06018.48
5.4.320.0070.04112.50
5.4.310.0090.04212.50
5.4.300.0080.03712.51
5.4.290.0140.07312.48
5.4.280.0120.07512.39
5.4.270.0130.05512.38
5.4.260.0130.09212.38
5.4.250.0120.05412.38
5.4.240.0120.06112.39
5.4.230.0090.05712.38
5.4.220.0110.05512.38
5.4.210.0080.05012.38
5.4.200.0100.05112.38
5.4.190.0090.04612.38
5.4.180.0070.05512.37
5.4.170.0150.06312.38
5.4.160.0140.06912.38
5.4.150.0150.06112.37
5.4.140.0090.07012.05
5.4.130.0120.05512.05
5.4.120.0110.08112.00
5.4.110.0120.08512.00
5.4.100.0160.08312.00
5.4.90.0130.06312.00
5.4.80.0230.07912.00
5.4.70.0200.09712.00
5.4.60.0080.04712.00
5.4.50.0140.06812.00
5.4.40.0250.10911.98
5.4.30.0160.10711.98
5.4.20.0100.04811.98
5.4.10.0200.06411.98
5.4.00.0110.07911.47
5.3.290.0090.04012.80
5.3.280.0230.15412.71
5.3.270.0280.13412.72
5.3.260.0390.11912.71
5.3.250.0130.15612.72
5.3.240.0280.12512.72
5.3.230.0280.09612.71
5.3.220.0150.07612.68
5.3.210.0100.07212.68
5.3.200.0280.11412.68
5.3.190.0130.07312.68
5.3.180.0060.05412.67
5.3.170.0280.18012.67
5.3.160.0090.06312.68
5.3.150.0130.12712.68
5.3.140.0100.05312.66
5.3.130.0100.06312.66
5.3.120.0090.05812.66
5.3.110.0120.07712.66
5.3.100.0270.09812.13
5.3.90.0310.11612.11
5.3.80.0170.11612.10
5.3.70.0170.09412.10
5.3.60.0320.13312.09
5.3.50.0220.10312.04
5.3.40.0230.10112.04
5.3.30.0110.09212.00
5.3.20.0150.07911.78
5.3.10.0150.10111.74
5.3.00.0130.08411.73
5.2.170.0150.0719.23
5.2.160.0120.0569.23
5.2.150.0230.1079.23
5.2.140.0120.0929.23
5.2.130.0070.0459.19
5.2.120.0070.0399.19
5.2.110.0060.0389.20
5.2.100.0080.0589.19
5.2.90.0140.0579.19
5.2.80.0130.0609.19
5.2.70.0150.0529.19
5.2.60.0080.0429.14
5.2.50.0170.0909.11
5.2.40.0110.0729.09
5.2.30.0150.0799.06
5.2.20.0160.0829.05
5.2.10.0230.0748.96
5.2.00.0130.0918.82
5.1.60.0090.0628.11
5.1.50.0140.0778.10
5.1.40.0180.0468.08
5.1.30.0090.0538.43
5.1.20.0120.0598.45
5.1.10.0120.0688.18
5.1.00.0200.0538.18
5.0.50.0070.0256.66
5.0.40.0070.0266.52
5.0.30.0110.0786.33
5.0.20.0040.0346.30
5.0.10.0130.0406.28
5.0.00.0060.0726.27
4.4.90.0090.0434.78
4.4.80.0200.0344.75
4.4.70.0110.0294.75
4.4.60.0030.0374.76
4.4.50.0040.0394.77
4.4.40.0070.0564.71
4.4.30.0150.0564.76
4.4.20.0040.0444.84
4.4.10.0060.0424.85
4.4.00.0040.0424.76
4.3.110.0120.0624.67
4.3.100.0180.0624.66
4.3.90.0090.0354.64
4.3.80.0150.0744.59
4.3.70.0150.1024.63
4.3.60.0050.0384.62
4.3.50.0100.0374.63
4.3.40.0030.0304.53
4.3.30.0040.0383.30
4.3.20.0030.0243.28
4.3.10.0050.0273.24
4.3.00.0200.01310.54

preferences:
39.92 ms | 401 KiB | 5 Q