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[0] = 'dobee'; //$test->__set($array[$first_key] , $blah ); foreach($array as $k => $v) { //print_r($k); if($v == 'Testsecret') { print_r('HERE n'); } //print_r($v); } } } $intercept = new Intercept; $intercept->getKey($test); // end editing here //echo $test->run(); $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.0150.00016.73
8.3.50.0120.00621.99
8.3.40.0070.01118.67
8.3.30.0000.01419.09
8.3.20.0070.00720.34
8.3.10.0000.00823.70
8.3.00.0030.00519.51
8.2.180.0120.00318.29
8.2.170.0170.00022.96
8.2.160.0000.01320.52
8.2.150.0060.00324.18
8.2.140.0070.00024.66
8.2.130.0070.00726.16
8.2.120.0040.00422.09
8.2.110.0050.00520.59
8.2.100.0000.01117.97
8.2.90.0080.00019.30
8.2.80.0040.00417.97
8.2.70.0000.00817.75
8.2.60.0000.00918.05
8.2.50.0060.00618.07
8.2.40.0030.00620.01
8.2.30.0020.00518.04
8.2.20.0070.00317.75
8.2.10.0000.00818.07
8.2.00.0080.00417.76
8.1.280.0130.00325.92
8.1.270.0000.00823.91
8.1.260.0050.00326.35
8.1.250.0050.00228.09
8.1.240.0030.00624.02
8.1.230.0040.00817.45
8.1.220.0040.00417.79
8.1.210.0040.00418.77
8.1.200.0060.00317.47
8.1.190.0000.00817.54
8.1.180.0100.00019.01
8.1.170.0080.00018.59
8.1.160.0050.00221.92
8.1.150.0080.00018.67
8.1.140.0000.00717.34
8.1.130.0030.00317.86
8.1.120.0050.00217.41
8.1.110.0000.01117.39
8.1.100.0040.00417.48
8.1.90.0050.00217.40
8.1.80.0000.00717.49
8.1.70.0040.00417.48
8.1.60.0080.00017.60
8.1.50.0000.00817.45
8.1.40.0020.00517.51
8.1.30.0040.00417.68
8.1.20.0050.00317.59
8.1.10.0030.00517.50
8.1.00.0000.01017.54
8.0.300.0030.00618.77
8.0.290.0040.00416.75
8.0.280.0040.00418.41
8.0.270.0030.00317.37
8.0.260.0000.00617.21
8.0.250.0030.00317.03
8.0.240.0040.00416.95
8.0.230.0000.00717.00
8.0.220.0000.00716.85
8.0.210.0050.00317.04
8.0.200.0000.00817.04
8.0.190.0080.00016.95
8.0.180.0080.00017.01
8.0.170.0060.00316.91
8.0.160.0080.00016.99
8.0.150.0030.00516.97
8.0.140.0000.00716.90
8.0.130.0060.00013.45
8.0.120.0070.00017.03
8.0.110.0030.00516.87
8.0.100.0040.00417.05
8.0.90.0000.00716.92
8.0.80.0130.00316.95
8.0.70.0000.00716.88
8.0.60.0030.00616.99
8.0.50.0040.00317.01
8.0.30.0080.01017.17
8.0.20.0100.01017.40
8.0.10.0000.00717.04
8.0.00.0050.01316.80
7.4.330.0070.00015.00
7.4.320.0040.00316.64
7.4.300.0030.00316.51
7.4.290.0030.00316.64
7.4.280.0040.00416.54
7.4.270.0040.00416.55
7.4.260.0000.00616.45
7.4.250.0050.00216.59
7.4.240.0050.00216.48
7.4.230.0050.00316.75
7.4.220.0210.00316.57
7.4.210.0120.00716.64
7.4.200.0030.00316.71
7.4.190.0070.00016.78
7.4.160.0130.00316.55
7.4.150.0170.00017.40
7.4.140.0070.01217.86
7.4.130.0130.00716.49
7.4.120.0080.00816.64
7.4.110.0090.00916.59
7.4.100.0120.00616.53
7.4.90.0070.01016.60
7.4.80.0150.00319.39
7.4.70.0080.00816.33
7.4.60.0070.01016.59
7.4.50.0040.00416.55
7.4.40.0070.01022.77
7.4.30.0080.00916.57
7.4.00.0070.01114.83
7.3.330.0000.00613.30
7.3.320.0030.00313.24
7.3.310.0000.00716.29
7.3.300.0040.00416.44
7.3.290.0070.00716.47
7.3.280.0080.00816.45
7.3.270.0040.01217.40
7.3.260.0070.01016.51
7.3.250.0120.00716.44
7.3.240.0120.00516.36
7.3.230.0110.00716.63
7.3.210.0070.01016.62
7.3.200.0080.00816.42
7.3.190.0030.01616.64
7.3.180.0140.00716.66
7.3.170.0120.00316.50
7.3.160.0080.00816.40
7.3.120.0070.00914.90
7.3.110.0060.00914.96
7.3.100.0080.01014.96
7.3.90.0070.00714.78
7.3.80.0070.00714.98
7.3.70.0020.01014.77
7.3.60.0040.01114.77
7.3.50.0050.00614.83
7.3.40.0020.00914.87
7.3.30.0040.00614.87
7.3.20.0020.01016.63
7.3.10.0040.01316.71
7.3.00.0090.00516.73
7.2.330.0120.00616.79
7.2.320.0130.00316.85
7.2.310.0130.00316.63
7.2.300.0220.03316.71
7.2.290.0090.01116.88
7.2.250.0060.01315.05
7.2.240.0110.00814.93
7.2.230.0080.00714.94
7.2.220.0090.00715.02
7.2.210.0080.00615.05
7.2.200.0040.01114.99
7.2.190.0050.00515.05
7.2.180.0080.00515.03
7.2.170.0050.00815.15
7.2.160.0100.00315.00
7.2.150.0060.00917.11
7.2.140.0100.00616.83
7.2.130.0060.00616.74
7.2.120.0070.00717.05
7.2.110.0090.00616.77
7.2.100.0030.01016.69
7.2.90.0000.01716.95
7.2.80.0000.01016.82
7.2.70.0090.00617.13
7.2.60.0070.00717.03
7.2.50.0070.00716.78
7.2.40.0060.00917.02
7.2.30.0130.00317.01
7.2.20.0000.01617.03
7.2.10.0090.00616.98
7.2.00.0080.00618.19
7.1.330.0070.00916.04
7.1.320.0070.00715.83
7.1.310.0080.00615.73
7.1.300.0040.00615.82
7.1.290.0050.00515.81
7.1.280.0080.00515.82
7.1.270.0030.00715.92
7.1.260.0030.01115.80
7.1.250.0070.00715.68
7.1.240.0100.00315.61
7.1.230.0030.00916.02
7.1.220.0030.01015.55
7.1.210.0090.00315.97
7.1.200.0070.00715.61
7.1.190.0060.00915.90
7.1.180.0060.00315.85
7.1.170.0040.00715.48
7.1.160.0000.01215.75
7.1.150.0070.00715.78
7.1.140.0090.00615.73
7.1.130.0030.00915.60
7.1.120.0100.00315.86
7.1.110.0070.01015.61
7.1.100.0060.00716.98
7.1.90.0060.00916.00
7.1.80.0070.00715.91
7.1.70.0000.01316.30
7.1.60.0080.01117.62
7.1.50.0100.00816.42
7.1.40.0100.00315.91
7.1.30.0100.00315.47
7.1.20.0100.00315.73
7.1.10.0000.01015.84
7.1.00.0050.04118.95
7.0.330.0090.00615.58
7.0.320.0000.01015.32
7.0.310.0060.01015.44
7.0.300.0030.01315.36
7.0.290.0030.01515.38
7.0.280.0070.00315.44
7.0.270.0040.01215.44
7.0.260.0090.00315.56
7.0.250.0030.01215.36
7.0.240.0070.00715.48
7.0.230.0070.01015.54
7.0.220.0040.01115.29
7.0.210.0030.01015.52
7.0.200.0100.00216.21
7.0.190.0080.00315.52
7.0.180.0070.01015.48
7.0.170.0030.01215.36
7.0.160.0130.00015.52
7.0.150.0100.00015.63
7.0.140.0070.03918.69
7.0.130.0120.00315.62
7.0.120.0130.00315.35
7.0.110.0060.00615.47
7.0.100.0100.00315.59
7.0.90.0120.00615.50
7.0.80.0030.01015.41
7.0.70.0030.01215.56
7.0.60.0070.03817.85
7.0.50.0080.04316.69
7.0.40.0030.03616.91
7.0.30.0150.03116.78
7.0.20.0120.02116.74
7.0.10.0020.04916.76
7.0.00.0080.04316.90
5.6.400.0100.00314.56
5.6.390.0060.01014.60
5.6.380.0110.00414.86
5.6.370.0090.00614.23
5.6.360.0130.00314.45
5.6.350.0070.00714.24
5.6.340.0100.00314.14
5.6.330.0090.00614.59
5.6.320.0070.00714.41
5.6.310.0000.01514.59
5.6.300.0030.00914.58
5.6.290.0030.01214.40
5.6.280.0080.03617.80
5.6.270.0060.01214.56
5.6.260.0030.01214.71
5.6.250.0110.00414.66
5.6.240.0090.00314.54
5.6.230.0040.00814.62
5.6.220.0070.00714.58
5.6.210.0060.04617.44
5.6.200.0120.03016.36
5.6.190.0100.04517.45
5.6.180.0200.03517.61
5.6.170.0120.02417.39
5.6.160.0130.02517.61
5.6.150.0050.02316.35
5.6.140.0070.02716.32
5.6.130.0020.03116.41
5.6.120.0080.04317.89
5.6.110.0100.03817.67
5.6.100.0070.04717.83
5.6.90.0060.04617.87
5.6.80.0120.03717.48
5.6.70.0040.00814.56
5.6.60.0070.01014.27
5.6.50.0070.01014.40
5.6.40.0070.00714.35
5.6.30.0000.01114.06
5.6.20.0070.01014.42
5.6.10.0000.00814.05
5.6.00.0060.00314.50
5.5.380.0090.00314.63
5.5.370.0030.01014.36
5.5.360.0070.00714.63
5.5.350.0170.01817.34
5.5.340.0080.02316.27
5.5.330.0130.03817.42
5.5.320.0060.04317.41
5.5.310.0180.03117.44
5.5.300.0060.04316.15
5.5.290.0100.03816.30
5.5.280.0130.03817.54
5.5.270.0030.03417.67
5.5.260.0120.03517.64
5.5.250.0080.03917.47
5.5.240.0030.02817.13
5.5.230.0090.00614.57
5.5.220.0150.00014.02
5.5.210.0030.01214.53
5.5.200.0060.00914.25
5.5.190.0060.00614.13
5.5.180.0060.00614.42
5.5.170.0080.00314.16
5.5.160.0040.00514.35
5.5.150.0030.00614.18
5.5.140.0090.00614.20
5.5.130.0060.00614.13
5.5.120.0090.00614.20
5.5.110.0110.00014.16
5.5.100.0000.01514.05
5.5.90.0060.00914.19
5.5.80.0030.00914.30
5.5.70.0100.00314.29
5.5.60.0000.01214.51
5.5.50.0070.00714.21
5.5.40.0000.01114.54
5.5.30.0100.00014.11
5.5.20.0070.00314.26
5.5.10.0040.01414.38
5.5.00.0030.00713.96
5.4.450.0300.03015.37
5.4.440.0120.02815.38
5.4.430.0050.03515.21
5.4.420.0080.03015.10
5.4.410.0080.03015.25
5.4.400.0080.02815.11
5.4.390.0020.03615.18
5.4.380.0240.02514.92
5.4.370.0320.02714.92
5.4.360.0230.02715.00
5.4.350.0160.03314.88
5.4.340.0220.02715.08
5.4.330.0120.00010.98
5.4.320.0050.02511.83
5.4.310.0070.02311.75
5.4.300.0060.02112.03
5.4.290.0090.04011.74
5.4.280.0080.03011.85
5.4.270.0090.03211.71
5.4.260.0090.03311.69
5.4.250.0090.02911.68
5.4.240.0070.03011.90
5.4.230.0120.02711.73
5.4.220.0100.03411.83
5.4.210.0090.02711.68
5.4.200.0070.02911.81
5.4.190.0160.05211.68
5.4.180.0150.05911.68
5.4.170.0080.03411.79
5.4.160.0060.03111.88
5.4.150.0050.03211.81
5.4.140.0040.03511.62
5.4.130.0070.04311.63
5.4.120.0080.03411.60
5.4.110.0090.03411.56
5.4.100.0060.03711.60
5.4.90.0110.05711.58
5.4.80.0080.04111.71
5.4.70.0060.03711.67
5.4.60.0080.03011.53
5.4.50.0070.03711.57
5.4.40.0050.03011.53
5.4.30.0120.02611.56
5.4.20.0090.02511.69
5.4.10.0040.02611.59
5.4.00.0020.02511.40
5.3.290.0090.02311.89
5.3.280.0040.02311.85
5.3.270.0040.02611.85
5.3.260.0070.02811.85
5.3.250.0080.02711.85
5.3.240.0050.02911.85
5.3.230.0050.02911.85
5.3.220.0060.03111.83
5.3.210.0080.03011.83
5.3.200.0050.03011.83
5.3.190.0060.02511.83
5.3.180.0020.03211.83
5.3.170.0050.02511.83
5.3.160.0080.02811.83
5.3.150.0040.03311.83
5.3.140.0090.02311.82
5.3.130.0040.03811.82
5.3.120.0100.02611.82
5.3.110.0040.03511.82
5.3.100.0050.03311.55
5.3.90.0040.03511.54
5.3.80.0050.03011.54
5.3.70.0070.03411.54
5.3.60.0090.03511.54
5.3.50.0080.02211.51
5.3.40.0070.02711.51
5.3.30.0080.02711.49
5.3.20.0050.02611.38
5.3.10.0040.02511.36
5.3.00.0060.02311.36
5.2.170.0100.0319.23
5.2.160.0050.0359.23
5.2.150.0030.0339.23
5.2.140.0050.0329.23
5.2.130.0050.0319.19
5.2.120.0050.0319.19
5.2.110.0070.0289.19
5.2.100.0060.0349.19
5.2.90.0080.0469.19
5.2.80.0070.0299.18
5.2.70.0040.0349.19
5.2.60.0050.0319.14
5.2.50.0050.0319.11
5.2.40.0050.0359.08
5.2.30.0050.0339.06
5.2.20.0060.0329.04
5.2.10.0090.0258.95
5.2.00.0100.0318.82
5.1.60.0060.0278.10
5.1.50.0060.0268.10
5.1.40.0070.0338.07
5.1.30.0050.0378.43
5.1.20.0080.0338.45
5.1.10.0050.0428.18
5.1.00.0110.0298.17
5.0.50.0080.0176.65
5.0.40.0060.0286.52
5.0.30.0070.0416.32
5.0.20.0080.0376.29
5.0.10.0040.0296.27
5.0.00.0060.0356.27
4.4.90.0040.0144.78
4.4.80.0020.0174.75
4.4.70.0020.0234.75
4.4.60.0040.0154.75
4.4.50.0050.0214.77
4.4.40.0050.0324.71
4.4.30.0040.0214.76
4.4.20.0020.0184.84
4.4.10.0030.0244.85
4.4.00.0050.0254.76
4.3.110.0060.0204.67
4.3.100.0030.0234.66
4.3.90.0040.0174.63
4.3.80.0050.0304.59
4.3.70.0060.0194.63
4.3.60.0040.0204.62
4.3.50.0040.0204.63
4.3.40.0060.0284.54
4.3.30.0030.0203.30
4.3.20.0010.0223.28
4.3.10.0030.0203.24
4.3.00.0100.0206.93

preferences:
46.92 ms | 401 KiB | 5 Q