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 $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]); //$v = array(); //$v[$first_key] = 'blah'; //$blah = $v[$first_key]; $blah= array(); $blah[$first_key] = 'dobee'; $test->__set($array[$first_key] , $blah[$first_key] ); /* 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.0100.01016.75
8.3.50.0110.00522.07
8.3.40.0130.00718.92
8.3.30.0070.00719.17
8.3.20.0040.01120.34
8.3.10.0090.00023.71
8.3.00.0080.00019.50
8.2.180.0120.00918.31
8.2.170.0070.01022.96
8.2.160.0100.00720.40
8.2.150.0040.00424.18
8.2.140.0130.00024.66
8.2.130.0060.00326.16
8.2.120.0000.00822.02
8.2.110.0060.00320.47
8.2.100.0060.00617.84
8.2.90.0040.00419.09
8.2.80.0040.00417.97
8.2.70.0030.00617.63
8.2.60.0000.00717.93
8.2.50.0080.00018.07
8.2.40.0030.00519.95
8.2.30.0040.00418.07
8.2.20.0040.00417.68
8.2.10.0040.00418.02
8.2.00.0000.00817.69
8.1.280.0140.00425.92
8.1.270.0000.00822.14
8.1.260.0100.00026.35
8.1.250.0000.00728.09
8.1.240.0060.00322.14
8.1.230.0090.00317.54
8.1.220.0000.00817.74
8.1.210.0080.00018.77
8.1.200.0070.00417.13
8.1.190.0000.00817.55
8.1.180.0060.00318.10
8.1.170.0070.00318.59
8.1.160.0000.00722.01
8.1.150.0050.00218.60
8.1.140.0040.00417.43
8.1.130.0000.00717.84
8.1.120.0060.00317.46
8.1.110.0100.00017.42
8.1.100.0050.00217.30
8.1.90.0040.00417.45
8.1.80.0000.00817.38
8.1.70.0000.00717.41
8.1.60.0050.00317.61
8.1.50.0030.00617.56
8.1.40.0030.00617.54
8.1.30.0040.00417.57
8.1.20.0040.00417.68
8.1.10.0000.00817.60
8.1.00.0030.00617.39
8.0.300.0050.00218.77
8.0.290.0040.00416.63
8.0.280.0070.00018.33
8.0.270.0000.00717.23
8.0.260.0050.00217.29
8.0.250.0090.00016.98
8.0.240.0080.00017.00
8.0.230.0000.00716.86
8.0.220.0070.00016.90
8.0.210.0030.00516.91
8.0.200.0030.00317.04
8.0.190.0080.00016.84
8.0.180.0040.00416.83
8.0.170.0040.00417.00
8.0.160.0040.00416.91
8.0.150.0030.00416.97
8.0.140.0020.00516.91
8.0.130.0000.00613.42
8.0.120.0040.00416.77
8.0.110.0080.00016.95
8.0.100.0060.00316.90
8.0.90.0040.00416.76
8.0.80.0100.00616.96
8.0.70.0040.00417.04
8.0.60.0070.00316.79
8.0.50.0040.00416.96
8.0.30.0170.00216.93
8.0.20.0110.01017.40
8.0.10.0040.00417.10
8.0.00.0140.00317.00
7.4.330.0050.00015.00
7.4.320.0000.00716.63
7.4.300.0030.00316.54
7.4.290.0050.00216.54
7.4.280.0030.00316.47
7.4.270.0050.00216.61
7.4.260.0040.00416.61
7.4.250.0030.00616.54
7.4.240.0020.00516.57
7.4.230.0000.00716.64
7.4.220.0080.01216.64
7.4.210.0070.00816.66
7.4.200.0000.00716.41
7.4.190.0000.00716.70
7.4.160.0170.00716.53
7.4.150.0110.00717.40
7.4.140.0110.00817.86
7.4.130.0090.01216.51
7.4.120.0110.00716.67
7.4.110.0140.00316.45
7.4.100.0030.01616.52
7.4.90.0090.00916.61
7.4.80.0130.01219.39
7.4.70.0100.00616.28
7.4.60.0100.01016.57
7.4.50.0030.00616.71
7.4.40.0070.00722.77
7.4.30.0110.00716.62
7.4.10.0060.00915.26
7.4.00.0040.00914.88
7.3.330.0000.00613.40
7.3.320.0000.00613.39
7.3.310.0040.00416.26
7.3.300.0080.00016.34
7.3.290.0100.01016.38
7.3.280.0110.01016.41
7.3.270.0060.01217.40
7.3.260.0120.00616.55
7.3.250.0090.00816.32
7.3.240.0090.00816.36
7.3.230.0140.00316.44
7.3.210.0080.00816.48
7.3.200.0160.00719.39
7.3.190.0160.00616.52
7.3.180.0000.01516.64
7.3.170.0060.00916.57
7.3.160.0070.01016.42
7.3.130.0030.01014.91
7.3.120.0080.00814.96
7.3.110.0100.00714.77
7.3.100.0040.01214.93
7.3.90.0030.00714.95
7.3.80.0030.01215.06
7.3.70.0040.00714.61
7.3.60.0070.00714.94
7.3.50.0000.01014.91
7.3.40.0030.00914.98
7.3.30.0070.00714.87
7.3.20.0060.00916.41
7.3.10.0050.01316.58
7.3.00.0070.00516.55
7.2.330.0030.01416.39
7.2.320.0030.01516.47
7.2.310.0030.01316.73
7.2.300.0070.01116.76
7.2.290.0100.00616.50
7.2.260.0060.01314.95
7.2.250.0070.01014.95
7.2.240.0070.01014.83
7.2.230.0080.00414.96
7.2.220.0090.00615.17
7.2.210.0070.00714.89
7.2.200.0110.00315.22
7.2.190.0030.01215.13
7.2.180.0030.00614.90
7.2.170.0120.00314.92
7.2.160.0040.00715.25
7.2.150.0060.01016.91
7.2.140.0070.00716.77
7.2.130.0120.00416.78
7.2.120.0100.00516.85
7.2.110.0090.00616.77
7.2.100.0080.00716.90
7.2.90.0080.00816.89
7.2.80.0070.01116.78
7.2.70.0160.00316.81
7.2.60.0060.00716.97
7.2.50.0070.00916.90
7.2.40.0090.00616.78
7.2.30.0070.00817.02
7.2.20.0120.00816.76
7.2.10.0070.01116.78
7.2.00.0080.00717.77
7.1.330.0070.01015.86
7.1.320.0090.00915.82
7.1.310.0060.00615.92
7.1.300.0030.01015.63
7.1.290.0030.00715.78
7.1.280.0000.01315.89
7.1.270.0060.00315.73
7.1.260.0040.00815.73
7.1.250.0080.00515.65
7.1.240.0130.00015.83
7.1.230.0040.00715.91
7.1.220.0120.00015.77
7.1.210.0090.00615.73
7.1.200.0080.00515.76
7.1.190.0000.01615.75
7.1.180.0030.01315.85
7.1.170.0100.00715.53
7.1.160.0080.00316.02
7.1.150.0060.00615.58
7.1.140.0110.00015.96
7.1.130.0150.00315.93
7.1.120.0120.00315.91
7.1.110.0060.00615.79
7.1.100.0020.00917.01
7.1.90.0070.00715.92
7.1.80.0000.01315.94
7.1.70.0020.00716.53
7.1.60.0060.01317.64
7.1.50.0110.01016.28
7.1.40.0090.00916.02
7.1.30.0040.00715.95
7.1.20.0110.00315.79
7.1.10.0090.00315.81
7.1.00.0000.04419.10
7.0.330.0090.00615.33
7.0.320.0070.00415.17
7.0.310.0070.00715.39
7.0.300.0060.01015.31
7.0.290.0030.01015.40
7.0.280.0110.00415.52
7.0.270.0030.00515.45
7.0.260.0040.00715.46
7.0.250.0030.00715.20
7.0.240.0060.00915.30
7.0.230.0030.00915.50
7.0.220.0000.00915.23
7.0.210.0070.00315.56
7.0.200.0070.00316.13
7.0.190.0060.01215.25
7.0.180.0110.00015.41
7.0.170.0100.00715.53
7.0.160.0030.00815.62
7.0.150.0060.01015.45
7.0.140.0050.03818.91
7.0.130.0130.00315.59
7.0.120.0070.00715.70
7.0.110.0040.00715.47
7.0.100.0070.00715.42
7.0.90.0110.00015.46
7.0.80.0030.00715.55
7.0.70.0000.00815.37
7.0.60.0070.03817.63
7.0.50.0100.03616.72
7.0.40.0100.04016.88
7.0.30.0170.04216.80
7.0.20.0170.03216.91
7.0.10.0200.03016.94
7.0.00.0070.04916.89
5.6.400.0000.01213.90
5.6.390.0000.00914.43
5.6.380.0040.01114.80
5.6.370.0030.01214.42
5.6.360.0040.00714.50
5.6.350.0030.00914.24
5.6.340.0060.00914.43
5.6.330.0040.00814.54
5.6.320.0030.00714.67
5.6.310.0040.01414.62
5.6.300.0090.00014.55
5.6.290.0070.00714.77
5.6.280.0050.04017.66
5.6.270.0000.01414.29
5.6.260.0060.00314.38
5.6.250.0000.01414.64
5.6.240.0090.00314.37
5.6.230.0080.00414.53
5.6.220.0000.01014.34
5.6.210.0050.04717.41
5.6.200.0070.04316.37
5.6.190.0070.02017.67
5.6.180.0160.02817.38
5.6.170.0170.04017.47
5.6.160.0080.04717.57
5.6.150.0050.03216.31
5.6.140.0030.04816.45
5.6.130.0030.04316.50
5.6.120.0050.04117.77
5.6.110.0120.04117.78
5.6.100.0070.04817.67
5.6.90.0080.04217.82
5.6.80.0150.01517.42
5.6.70.0180.04217.40
5.6.60.0140.00014.49
5.6.50.0110.00014.46
5.6.40.0030.00614.16
5.6.30.0030.01314.48
5.6.20.0030.01214.43
5.6.10.0090.00614.29
5.6.00.0120.00314.51
5.5.380.0080.00614.42
5.5.370.0000.01414.48
5.5.360.0060.00614.37
5.5.350.0080.03817.38
5.5.340.0100.04216.16
5.5.330.0130.03817.28
5.5.320.0170.04417.24
5.5.310.0160.03317.32
5.5.300.0110.02216.28
5.5.290.0020.02716.03
5.5.280.0100.04117.68
5.5.270.0110.04217.82
5.5.260.0070.03917.54
5.5.250.0070.02217.38
5.5.240.0110.03817.35
5.5.230.0040.00714.35
5.5.220.0060.00614.49
5.5.210.0000.01414.05
5.5.200.0070.00714.45
5.5.190.0090.00614.18
5.5.180.0060.00914.47
5.5.170.0080.00414.33
5.5.160.0130.00314.24
5.5.150.0120.00914.29
5.5.140.0130.00314.33
5.5.130.0000.02014.46
5.5.120.0040.01214.44
5.5.110.0050.01013.96
5.5.100.0090.00914.59
5.5.90.0040.01614.63
5.5.80.0070.01114.48
5.5.70.0090.00914.21
5.5.60.0080.00814.29
5.5.50.0070.00714.34
5.5.40.0150.00614.40
5.5.30.0040.00714.51
5.5.20.0030.01314.45
5.5.10.0060.01014.41
5.5.00.0030.00614.34
5.4.450.0320.03515.78
5.4.440.0550.04115.91
5.4.430.0430.03415.84
5.4.420.0450.03715.96
5.4.410.0380.03315.92
5.4.400.0460.02415.61
5.4.390.0420.03515.81
5.4.380.0180.03215.47
5.4.370.0230.04015.56
5.4.360.0200.03115.58
5.4.350.0170.03015.45
5.4.340.0180.03315.56
5.4.330.0060.00912.36
5.4.320.0060.02612.44
5.4.310.0030.02412.43
5.4.300.0070.01812.44
5.4.290.0030.02412.43
5.4.280.0070.01712.37
5.4.270.0070.02112.38
5.4.260.0080.01912.38
5.4.250.0070.02012.38
5.4.240.0050.02312.37
5.4.230.0040.02412.37
5.4.220.0050.02212.37
5.4.210.0030.02412.37
5.4.200.0060.02312.37
5.4.190.0050.02212.37
5.4.180.0030.02012.37
5.4.170.0080.01812.37
5.4.160.0050.02112.37
5.4.150.0030.02512.37
5.4.140.0070.02212.21
5.4.130.0080.01812.21
5.4.120.0060.02712.18
5.4.110.0030.02312.18
5.4.100.0050.02112.18
5.4.90.0060.02612.18
5.4.80.0080.02312.18
5.4.70.0070.01812.18
5.4.60.0050.01812.18
5.4.50.0060.02012.18
5.4.40.0040.02212.18
5.4.30.0030.02412.17
5.4.20.0050.02112.17
5.4.10.0060.02212.17
5.4.00.0040.02311.92
5.3.290.0030.03212.58
5.3.280.0040.02312.54
5.3.270.0050.02212.54
5.3.260.0020.02612.54
5.3.250.0070.02112.54
5.3.240.0030.02412.54
5.3.230.0030.02212.53
5.3.220.0040.02212.52
5.3.210.0050.02412.52
5.3.200.0030.02412.52
5.3.190.0050.02712.52
5.3.180.0050.02312.52
5.3.170.0060.02112.52
5.3.160.0040.02212.52
5.3.150.0020.02712.52
5.3.140.0040.02312.51
5.3.130.0020.02412.51
5.3.120.0070.02012.51
5.3.110.0020.02612.51
5.3.100.0040.02212.24
5.3.90.0040.02212.25
5.3.80.0040.02112.23
5.3.70.0050.02012.23
5.3.60.0070.01912.23
5.3.50.0070.02012.20
5.3.40.0040.02412.20
5.3.30.0050.02112.18
5.3.20.0040.02212.07
5.3.10.0040.02212.05
5.3.00.0030.02312.04
5.2.170.0060.0329.23
5.2.160.0050.0299.23
5.2.150.0060.0319.24
5.2.140.0050.0459.23
5.2.130.0050.0329.19
5.2.120.0050.0309.19
5.2.110.0030.0319.20
5.2.100.0040.0299.20
5.2.90.0050.0319.20
5.2.80.0030.0379.19
5.2.70.0040.0339.18
5.2.60.0010.0349.14
5.2.50.0070.0289.11
5.2.40.0050.0309.09
5.2.30.0060.0299.06
5.2.20.0080.0339.05
5.2.10.0050.0308.96
5.2.00.0070.0288.82
5.1.60.0060.0238.10
5.1.50.0070.0258.10
5.1.40.0050.0308.08
5.1.30.0050.0298.43
5.1.20.0080.0248.45
5.1.10.0050.0268.18
5.1.00.0050.0258.18
5.0.50.0060.0206.65
5.0.40.0030.0216.52
5.0.30.0050.0326.32
5.0.20.0030.0236.30
5.0.10.0050.0196.28
5.0.00.0030.0366.27
4.4.90.0010.0184.78
4.4.80.0030.0154.75
4.4.70.0020.0164.75
4.4.60.0020.0164.75
4.4.50.0040.0144.77
4.4.40.0000.0294.71
4.4.30.0030.0164.75
4.4.20.0050.0154.85
4.4.10.0050.0164.85
4.4.00.0020.0274.76
4.3.110.0050.0154.67
4.3.100.0040.0154.66
4.3.90.0010.0244.64
4.3.80.0020.0284.58
4.3.70.0040.0214.63
4.3.60.0020.0164.63
4.3.50.0030.0234.63
4.3.40.0030.0274.54
4.3.30.0020.0233.30
4.3.20.0010.0243.28
4.3.10.0020.0223.23
4.3.00.0170.01310.54

preferences:
50.53 ms | 401 KiB | 5 Q