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; 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 print_r($key);die(); $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['blah']); /* foreach($array as $k => $v) { print_r($k); print_r($v); } */ } } $intercept = new Intercept; $intercept->getKey($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)
8.3.60.0090.00616.63
8.3.50.0080.01022.09
8.3.40.0100.00718.88
8.3.30.0110.00319.23
8.3.20.0150.00020.20
8.3.10.0030.00523.71
8.3.00.0080.00019.35
8.2.180.0140.00718.18
8.2.170.0060.01222.96
8.2.160.0140.00420.44
8.2.150.0080.00025.66
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0060.00322.16
8.2.110.0060.00322.07
8.2.100.0040.00817.84
8.2.90.0080.00019.02
8.2.80.0000.00817.97
8.2.70.0040.00417.63
8.2.60.0000.00917.93
8.2.50.0060.00618.07
8.2.40.0030.00520.04
8.2.30.0070.00318.13
8.2.20.0040.00417.68
8.2.10.0030.00618.07
8.2.00.0060.00317.75
8.1.280.0100.01025.92
8.1.270.0050.00323.99
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0060.00323.91
8.1.230.0060.00619.15
8.1.220.0040.00417.77
8.1.210.0000.00918.77
8.1.200.0070.00317.35
8.1.190.0080.00017.39
8.1.180.0050.00318.10
8.1.170.0030.00618.52
8.1.160.0050.00221.95
8.1.150.0000.01018.59
8.1.140.0040.00417.40
8.1.130.0000.00717.77
8.1.120.0000.00717.34
8.1.110.0070.00417.46
8.1.100.0000.00717.30
8.1.90.0080.00017.31
8.1.80.0040.00417.40
8.1.70.0070.00017.48
8.1.60.0080.00017.59
8.1.50.0030.00617.42
8.1.40.0040.00417.52
8.1.30.0080.00017.60
8.1.20.0040.00417.65
8.1.10.0040.00417.61
8.1.00.0040.00417.57
8.0.300.0070.00018.77
8.0.290.0000.00716.93
8.0.280.0040.00418.41
8.0.270.0030.00317.17
8.0.260.0030.00317.16
8.0.250.0000.00716.86
8.0.240.0000.00716.98
8.0.230.0000.00716.96
8.0.220.0000.00716.90
8.0.210.0050.00416.81
8.0.200.0020.00516.95
8.0.190.0040.00416.95
8.0.180.0050.00516.81
8.0.170.0040.00416.84
8.0.160.0040.00416.91
8.0.150.0070.00016.88
8.0.140.0040.00416.86
8.0.130.0000.00813.30
8.0.120.0060.00316.83
8.0.110.0040.00416.88
8.0.100.0000.00716.75
8.0.90.0040.00416.68
8.0.80.0150.00616.87
8.0.70.0040.00416.94
8.0.60.0050.00516.95
8.0.50.0040.00416.96
8.0.30.0100.01017.16
8.0.20.0090.01317.40
8.0.10.0040.00417.09
8.0.00.0110.00816.85
7.4.330.0030.00315.00
7.4.320.0070.00016.47
7.4.300.0000.00616.53
7.4.290.0030.00316.54
7.4.280.0040.00416.42
7.4.270.0030.00316.44
7.4.260.0000.00716.43
7.4.250.0000.00716.43
7.4.240.0030.00316.63
7.4.230.0030.00316.42
7.4.220.0140.00416.58
7.4.210.0080.00716.61
7.4.200.0070.00016.63
7.4.190.0050.00216.75
7.4.160.0030.01616.59
7.4.150.0070.01017.40
7.4.140.0130.00417.86
7.4.130.0070.01216.58
7.4.120.0090.00816.58
7.4.110.0060.01216.46
7.4.100.0040.01416.67
7.4.90.0350.03716.57
7.4.80.0100.01019.39
7.4.70.0070.01016.73
7.4.60.0140.00716.39
7.4.50.0000.01016.62
7.4.40.0030.01022.77
7.4.30.0070.01416.51
7.4.00.0050.01314.97
7.3.330.0050.00313.43
7.3.320.0050.00013.29
7.3.310.0040.00416.54
7.3.300.0050.00316.30
7.3.290.0070.00716.45
7.3.280.0060.01116.43
7.3.270.0080.00817.40
7.3.260.0090.01516.64
7.3.250.0120.00816.40
7.3.240.0040.01616.32
7.3.230.0100.00716.41
7.3.210.0060.01316.64
7.3.200.0070.01719.39
7.3.190.0090.00916.61
7.3.180.0000.01516.48
7.3.170.0060.01016.45
7.3.160.0090.00616.61
7.3.120.0050.01114.81
7.3.110.0040.01214.78
7.3.100.0070.00714.93
7.3.90.0000.00914.86
7.3.80.0050.00514.87
7.3.70.0060.01014.78
7.3.60.0030.01014.66
7.3.50.0090.00914.70
7.3.40.0120.00314.90
7.3.30.0060.00914.90
7.3.20.0070.01016.35
7.3.10.0040.00816.38
7.3.00.0070.00716.55
7.2.330.0050.01416.69
7.2.320.0100.01016.68
7.2.310.0070.01016.51
7.2.300.0100.00716.46
7.2.290.0060.01116.54
7.2.250.0110.00715.03
7.2.240.0060.01215.10
7.2.230.0060.00914.86
7.2.220.0070.00715.29
7.2.210.0000.01715.00
7.2.200.0070.00714.88
7.2.190.0060.00914.80
7.2.180.0090.00314.88
7.2.170.0030.01415.14
7.2.00.0030.00919.53
7.1.330.0030.01015.88
7.1.320.0070.00316.02
7.1.310.0060.00615.76
7.1.300.0070.00715.73
7.1.290.0080.00615.67
7.1.280.0060.00915.80
7.1.270.0000.01615.90
7.1.260.0070.00715.71
7.1.200.0030.00715.68
7.1.100.0060.00918.29
7.1.70.0050.00217.08
7.1.60.0000.01117.30
7.1.50.0070.00717.00
7.1.40.0480.00616.48
7.1.30.2640.00715.15
7.1.20.0030.01016.91
7.1.10.0090.00316.69
7.1.00.0060.00916.67
7.0.200.0030.00716.84
7.0.190.0000.00816.54
7.0.180.0030.00616.24
7.0.170.0070.00715.98
7.0.160.0000.00916.18
7.0.150.0000.01316.10
7.0.140.0120.00016.23
7.0.130.0080.00416.45
7.0.120.0020.00916.66
7.0.110.0070.00416.30
7.0.100.0000.01116.45
7.0.90.0120.00016.10
7.0.80.0110.00316.34
7.0.70.0080.00416.18
7.0.60.0070.00716.18
7.0.50.0000.01316.38
7.0.40.0050.00815.15
7.0.30.0090.00415.15
7.0.20.0050.00815.15
7.0.10.0030.00815.15
7.0.00.0050.00515.15
5.6.300.0070.04420.71
5.6.290.0090.04620.91
5.6.280.0100.04021.04
5.6.270.0070.06920.87
5.6.260.0100.04221.00
5.6.250.0130.03620.91
5.6.240.0040.04320.88
5.6.230.0100.04020.84
5.6.220.0100.04120.96
5.6.210.0000.04721.07
5.6.200.0070.05220.75
5.6.190.0100.04020.99
5.6.180.0070.04121.00
5.6.170.0110.03920.78
5.6.160.0100.03720.78
5.6.150.0120.03920.85
5.6.140.0040.05620.83
5.6.130.0060.04320.83
5.6.120.0090.03920.87
5.6.110.0030.04420.77
5.6.100.0040.04721.02
5.6.90.0070.03820.91
5.6.80.0070.03620.21
5.6.70.0030.04220.24
5.6.60.0000.04520.22
5.6.50.0040.04120.42
5.6.40.0070.03320.35
5.6.30.0030.04120.12
5.6.20.0090.04120.27
5.6.10.0070.03920.34
5.6.00.0000.04720.18
5.5.380.0040.04217.48
5.5.370.0060.04417.62
5.5.360.0000.04817.45
5.5.350.0030.04317.48
5.5.340.0070.03718.02
5.5.330.0060.04118.02
5.5.320.0000.04218.09
5.5.310.0000.06618.14
5.5.300.0090.04018.09
5.5.290.0030.04517.84
5.5.280.0070.04217.86
5.5.270.0030.04417.73
5.5.260.0030.04218.09
5.5.250.0030.04517.87
5.5.240.0000.04517.50
5.5.230.0030.04517.08
5.5.220.0000.04117.50
5.5.210.0060.03517.24
5.5.200.0030.08117.40
5.5.190.0100.05917.35
5.5.180.0000.04117.41
5.5.160.0030.03917.44
5.5.150.0030.04117.38
5.5.140.0290.03217.18
5.5.130.0000.04317.52
5.5.120.0030.04017.38
5.5.110.0060.03617.08
5.5.100.0030.03817.38
5.5.90.0030.04117.37
5.5.80.0000.04017.37
5.5.70.0000.04317.34
5.5.60.0030.03717.37
5.5.50.0040.04217.33
5.5.40.0030.03916.98
5.5.30.0000.04417.32
5.5.20.0090.03117.37
5.5.10.0000.04017.34
5.5.00.0030.03717.33
5.4.450.0030.03919.52
5.4.440.0070.03719.39
5.4.430.0030.04319.28
5.4.420.0070.03519.38
5.4.410.0070.03719.41
5.4.400.0000.03919.07
5.4.390.0030.03719.13
5.4.380.0100.03318.89
5.4.370.0030.03818.98
5.4.360.0070.05719.21
5.4.350.0000.04318.96
5.4.340.0030.03618.98
5.4.320.0000.05018.95
5.4.310.0030.03919.24
5.4.300.0040.04318.92
5.4.290.0000.04419.08
5.4.280.0060.03719.20
5.4.270.0170.03419.20
5.4.260.0070.03618.99
5.4.250.0030.03918.98
5.4.240.0000.04819.23
5.4.230.0000.04118.94
5.4.220.0040.04219.13
5.4.210.0030.03719.13
5.4.200.0060.03519.06
5.4.190.0030.03619.05
5.4.180.0000.04019.07
5.4.170.0100.06918.97
5.4.160.0000.04018.91
5.4.150.0030.03918.91
5.4.140.0090.02816.55
5.4.130.0030.03516.72
5.4.120.0030.03416.67
5.4.110.0060.04216.69
5.4.100.0120.02716.75
5.4.90.0100.03216.70
5.4.80.0100.04716.67
5.4.70.0070.03716.74
5.4.60.0000.03816.66
5.4.50.0070.03316.72
5.4.40.0000.04316.73
5.4.30.0030.03516.61
5.4.20.0030.03416.60
5.4.10.0060.03116.68
5.4.00.0070.02915.94
5.3.290.0030.05015.15
5.3.280.0000.04615.15
5.3.270.0000.03915.15
5.3.260.0030.03615.15
5.3.250.0000.04815.15
5.3.240.0100.03115.15
5.3.230.0000.04215.15
5.3.220.0030.03515.15
5.3.210.0040.03515.15
5.3.200.0000.04315.15
5.3.190.0030.04715.15
5.3.180.0030.04215.15
5.3.170.0030.04115.15
5.3.160.0060.03315.15
5.3.150.0000.03915.15
5.3.140.0060.03315.15
5.3.130.0030.04315.15
5.3.120.0030.03715.15
5.3.110.0000.03915.15
5.3.100.0070.05615.15
5.3.90.0070.04315.15
5.3.80.0030.03615.15
5.3.70.0060.03515.15
5.3.60.0030.04015.15
5.3.50.0060.03615.15
5.3.40.0000.03915.15
5.3.30.0100.03015.15
5.3.20.0000.03915.15
5.3.10.0030.03215.15
5.3.00.0030.03415.15
5.2.170.0030.02815.15
5.2.160.0000.04215.15
5.2.150.0030.03415.15
5.2.140.0000.03715.15
5.2.130.0030.03515.15
5.2.120.0000.03215.15
5.2.110.0000.03115.15
5.2.100.0070.03015.15
5.2.90.0040.03215.15
5.2.80.0030.03015.15
5.2.70.0030.02915.15
5.2.60.0030.02915.15
5.2.50.0070.02715.15
5.2.40.0030.03015.15
5.2.30.0240.02715.15
5.2.20.0030.03015.15
5.2.10.0030.02615.15
5.2.00.0060.02515.15
5.1.60.0030.02315.15
5.1.50.0030.02415.15
5.1.40.0000.02815.15
5.1.30.0030.02415.15
5.1.20.0030.02615.15
5.1.10.0060.02215.15
5.1.00.0070.02115.15
5.0.50.0030.02015.15
5.0.40.0000.02215.15
5.0.30.0030.03115.15
5.0.20.0030.01915.15
5.0.10.0000.03215.15
5.0.00.0000.03515.15
4.4.90.0030.01315.15
4.4.80.0000.02015.15
4.4.70.0000.01815.15
4.4.60.0000.01615.15
4.4.50.0000.02015.15
4.4.40.0030.02215.15
4.4.30.0000.02415.15
4.4.20.0000.01915.15
4.4.10.0000.01815.15
4.4.00.0030.02315.15
4.3.110.0000.02315.15
4.3.100.0040.01815.15
4.3.90.0030.01415.15
4.3.80.0030.02415.15
4.3.70.0030.02415.15
4.3.60.0000.03015.15
4.3.50.0030.02515.15
4.3.40.0000.03515.15
4.3.30.0000.01815.15
4.3.20.0000.02415.15
4.3.10.0000.01615.15
4.3.00.0000.01615.15

preferences:
66.75 ms | 401 KiB | 5 Q