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($k == '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.70.0060.01018.56
8.3.60.0120.00616.86
8.3.50.0110.01022.01
8.3.40.0040.01518.93
8.3.30.0030.01019.21
8.3.20.0040.00420.25
8.3.10.0040.00423.66
8.3.00.0000.00819.38
8.2.180.0100.00718.28
8.2.170.0080.01122.96
8.2.160.0070.00720.39
8.2.150.0040.00424.18
8.2.140.0000.00924.66
8.2.130.0110.00726.16
8.2.120.0040.00421.87
8.2.110.0090.00022.30
8.2.100.0090.00317.91
8.2.90.0090.00019.31
8.2.80.0060.00317.97
8.2.70.0070.00317.63
8.2.60.0040.00418.05
8.2.50.0040.00418.07
8.2.40.0000.00820.07
8.2.30.0080.00018.24
8.2.20.0040.00417.91
8.2.10.0000.00818.21
8.2.00.0070.00417.79
8.1.280.0070.01025.92
8.1.270.0050.00323.76
8.1.260.0030.00626.35
8.1.250.0040.00428.09
8.1.240.0040.00423.81
8.1.230.0090.00319.23
8.1.220.0040.00417.79
8.1.210.0050.00318.77
8.1.200.0030.00617.35
8.1.190.0030.00517.43
8.1.180.0090.00018.10
8.1.170.0090.00018.50
8.1.160.0040.00422.04
8.1.150.0000.01018.63
8.1.140.0000.00817.44
8.1.130.0000.00717.73
8.1.120.0040.00417.51
8.1.110.0070.00317.45
8.1.100.0040.00317.53
8.1.90.0050.00317.51
8.1.80.0000.00717.40
8.1.70.0000.00817.41
8.1.60.0040.00417.61
8.1.50.0040.00417.42
8.1.40.0060.00317.56
8.1.30.0040.00417.61
8.1.20.0040.00417.59
8.1.10.0000.00917.53
8.1.00.0040.00417.47
8.0.300.0040.00420.73
8.0.290.0000.00717.17
8.0.280.0070.00018.39
8.0.270.0040.00417.29
8.0.260.0060.00017.29
8.0.250.0000.00717.02
8.0.240.0030.00616.92
8.0.230.0030.00317.02
8.0.220.0000.00716.88
8.0.210.0030.00316.89
8.0.200.0000.00817.00
8.0.190.0020.00517.06
8.0.180.0040.00416.94
8.0.170.0040.00417.01
8.0.160.0000.00716.87
8.0.150.0000.00716.99
8.0.140.0050.00216.83
8.0.130.0000.00613.34
8.0.120.0030.00516.99
8.0.110.0030.00516.98
8.0.100.0070.00017.07
8.0.90.0030.00316.89
8.0.80.0070.01017.00
8.0.70.0000.00816.79
8.0.60.0040.00416.88
8.0.50.0000.00716.94
8.0.30.0090.00916.97
8.0.20.0100.00817.40
8.0.10.0040.00416.94
8.0.00.0070.01117.10
7.4.330.0020.00215.00
7.4.320.0030.00316.43
7.4.300.0060.00016.59
7.4.290.0000.00716.62
7.4.280.0060.00316.64
7.4.270.0040.00416.64
7.4.260.0000.00716.54
7.4.250.0030.00616.48
7.4.240.0040.00316.56
7.4.230.0000.00716.37
7.4.220.0090.00816.48
7.4.210.0100.00716.57
7.4.200.0000.00716.61
7.4.190.0050.00216.44
7.4.160.0030.01216.79
7.4.150.0070.01717.40
7.4.140.0140.00717.86
7.4.130.0090.01116.54
7.4.120.0090.01016.54
7.4.110.0120.00916.59
7.4.100.0080.01116.53
7.4.90.0100.00716.59
7.4.80.0150.00319.39
7.4.70.0100.01016.59
7.4.60.0060.01116.53
7.4.50.0080.00016.54
7.4.40.0100.00322.77
7.4.30.0080.00816.59
7.4.10.0070.01114.98
7.4.00.0060.01014.97
7.3.330.0030.00313.41
7.3.320.0030.00313.38
7.3.310.0080.00016.48
7.3.300.0080.00016.24
7.3.290.0040.01116.46
7.3.280.0070.00816.42
7.3.270.0120.00417.40
7.3.260.0060.01016.41
7.3.250.0080.01216.57
7.3.240.0140.00516.70
7.3.230.0130.01216.59
7.3.210.0040.01216.55
7.3.200.0110.01119.39
7.3.190.0120.01016.51
7.3.180.0070.01016.44
7.3.170.0120.00416.47
7.3.160.0130.00416.35
7.3.130.0070.01214.99
7.3.120.0050.00914.96
7.3.110.0080.00614.91
7.3.100.0020.01214.96
7.3.90.0080.00814.73
7.3.80.0040.00714.78
7.3.70.0030.00814.76
7.3.60.0080.00214.65
7.3.50.0040.01214.66
7.3.40.0090.00414.74
7.3.30.0040.01114.69
7.3.20.0070.00516.71
7.3.10.0110.00316.66
7.3.00.0020.00716.59
7.2.330.0150.00916.50
7.2.320.0070.01016.54
7.2.310.0170.00016.76
7.2.300.0110.00616.72
7.2.290.0030.01416.78
7.2.260.0060.01315.11
7.2.250.0110.00815.05
7.2.240.0070.00815.05
7.2.230.0060.00915.03
7.2.220.0030.01114.96
7.2.210.0090.00314.96
7.2.200.0040.00815.01
7.2.190.0050.00714.88
7.2.180.0060.00814.89
7.2.170.0030.00915.10
7.2.160.0060.00615.00
7.2.150.0020.01016.84
7.2.140.0060.00816.87
7.2.130.0020.01316.90
7.2.120.0060.01016.95
7.2.110.0070.00716.90
7.2.100.0100.00716.88
7.2.90.0080.00716.98
7.2.80.0080.01016.80
7.2.70.0060.00816.92
7.2.60.0030.01016.91
7.2.50.0060.00617.00
7.2.40.0080.00617.03
7.2.30.0050.00616.97
7.2.20.0070.00717.11
7.2.10.0080.00616.87
7.2.00.0060.01117.79
7.1.330.0050.01215.86
7.1.320.0030.00915.84
7.1.310.0050.01115.85
7.1.300.0040.01215.85
7.1.290.0070.00815.61
7.1.280.0040.00615.81
7.1.270.0020.01215.71
7.1.260.0120.00515.61
7.1.250.0060.00815.84
7.1.240.0080.00615.70
7.1.230.0080.00315.72
7.1.220.0050.00815.70
7.1.210.0090.00415.56
7.1.200.0040.00715.88
7.1.190.0090.00315.71
7.1.180.0080.00715.89
7.1.170.0040.00715.71
7.1.160.0060.00715.76
7.1.150.0080.00515.55
7.1.140.0060.00515.79
7.1.130.0050.00815.52
7.1.120.0050.00815.68
7.1.110.0090.00315.72
7.1.100.0060.00516.55
7.1.90.0080.00215.70
7.1.80.0030.01115.55
7.1.70.0020.00816.15
7.1.60.0070.01016.93
7.1.50.0040.01116.02
7.1.40.0010.00715.56
7.1.30.0060.00715.66
7.1.20.0060.00915.83
7.1.10.0040.00915.79
7.1.00.0070.02817.97
7.0.330.0080.00715.38
7.0.320.0080.00715.37
7.0.310.0050.00715.25
7.0.300.0050.00615.44
7.0.290.0050.00815.33
7.0.280.0070.00515.41
7.0.270.0050.00715.46
7.0.260.0050.00815.37
7.0.250.0030.00915.53
7.0.240.0070.00715.51
7.0.230.0040.00815.34
7.0.220.0040.00615.30
7.0.210.0030.00815.38
7.0.200.0050.00615.74
7.0.190.0030.01015.42
7.0.180.0040.00715.43
7.0.170.0020.01015.40
7.0.160.0050.00515.42
7.0.150.0010.01115.38
7.0.140.0000.03217.56
7.0.130.0040.00515.47
7.0.120.0060.00615.14
7.0.110.0070.00415.44
7.0.100.0080.00315.40
7.0.90.0040.00815.26
7.0.80.0070.00415.24
7.0.70.0060.00515.34
7.0.60.0080.01516.93
7.0.50.0090.02616.20
7.0.40.0050.02215.79
7.0.30.0140.02915.85
7.0.20.0130.01715.71
7.0.10.0040.02015.80
7.0.00.0060.02015.79
5.6.400.0030.00814.44
5.6.390.0090.01014.43
5.6.380.0050.00914.52
5.6.370.0060.01014.61
5.6.360.0080.01014.37
5.6.350.0080.00714.64
5.6.340.0070.00714.69
5.6.330.0050.00814.51
5.6.320.0040.00914.63
5.6.310.0060.01014.52
5.6.300.0050.00614.32
5.6.290.0050.00814.52
5.6.280.0050.03116.57
5.6.270.0060.00714.51
5.6.260.0030.01014.39
5.6.250.0100.00214.51
5.6.240.0020.00814.32
5.6.230.0040.00614.61
5.6.220.0050.01014.34
5.6.210.0070.03116.53
5.6.200.0040.01815.65
5.6.190.0050.02216.59
5.6.180.0080.02216.45
5.6.170.0060.02016.36
5.6.160.0060.01816.34
5.6.150.0080.02615.58
5.6.140.0090.02115.60
5.6.130.0070.03115.63
5.6.120.0040.03216.68
5.6.110.0050.01916.79
5.6.100.0070.03316.46
5.6.90.0060.01916.54
5.6.80.0030.03116.19
5.6.70.1530.02016.40
5.6.60.0130.00114.43
5.6.50.0050.00814.36
5.6.40.0030.01014.29
5.6.30.0060.00614.41
5.6.20.0090.00514.39
5.6.10.0080.00514.51
5.6.00.0090.00814.36
5.5.380.0020.01114.51
5.5.370.0050.00914.31
5.5.360.0070.00714.21
5.5.350.0060.03216.52
5.5.340.0050.03115.65
5.5.330.0050.03216.33
5.5.320.0100.03416.47
5.5.310.0130.03016.32
5.5.300.0080.02915.57
5.5.290.0090.01315.68
5.5.280.0090.02716.60
5.5.270.0110.02816.40
5.5.260.0080.03216.51
5.5.250.0040.03316.49
5.5.240.0130.03216.33
5.5.230.0090.00514.39
5.5.220.0030.00814.23
5.5.210.0100.00314.34
5.5.200.0070.00814.32
5.5.190.0050.00914.57
5.5.180.0050.00914.53
5.5.170.0030.00614.30
5.5.160.0070.00914.40
5.5.150.0050.00814.05
5.5.140.0030.01014.45
5.5.130.0120.00314.55
5.5.120.0070.00514.54
5.5.110.0060.01114.21
5.5.100.0000.01614.29
5.5.90.0070.01014.23
5.5.80.0030.01014.27
5.5.70.0060.00814.52
5.5.60.0090.00314.49
5.5.50.0000.01114.36
5.5.40.0050.00814.18
5.5.30.0030.01014.16
5.5.20.0050.00714.39
5.5.10.0040.00814.12
5.5.00.0100.00714.43
5.4.450.0340.02115.28
5.4.440.0240.02315.24
5.4.430.0280.02315.25
5.4.420.0290.02015.29
5.4.410.0300.02015.21
5.4.400.0250.02715.21
5.4.390.0200.02615.16
5.4.380.0110.02515.04
5.4.370.0130.02615.01
5.4.360.0130.02115.02
5.4.350.0110.02315.03
5.4.340.0120.02315.02
5.4.330.0040.00613.14
5.4.320.0040.01812.93
5.4.310.0040.01912.93
5.4.300.0020.02112.93
5.4.290.0060.01612.92
5.4.280.0070.01912.89
5.4.270.0060.02012.89
5.4.260.0060.02512.89
5.4.250.0040.02412.89
5.4.240.0050.02312.89
5.4.230.0040.02312.89
5.4.220.0080.01912.89
5.4.210.0050.02212.89
5.4.200.0050.02112.89
5.4.190.0040.02412.88
5.4.180.0070.01912.89
5.4.170.0080.02512.89
5.4.160.0110.02012.89
5.4.150.0050.02412.89
5.4.140.0080.03612.78
5.4.130.0080.03012.78
5.4.120.0050.02212.76
5.4.110.0060.02112.76
5.4.100.0060.02912.76
5.4.90.0110.02612.76
5.4.80.0070.02212.76
5.4.70.0080.01912.76
5.4.60.0040.02112.76
5.4.50.0050.02312.76
5.4.40.0030.02312.76
5.4.30.0040.02312.76
5.4.20.0060.02212.76
5.4.10.0060.01912.75
5.4.00.0050.02212.58
5.3.290.0050.01813.03
5.3.280.0050.02213.00
5.3.270.0050.02213.00
5.3.260.0070.02013.00
5.3.250.0030.02413.00
5.3.240.0090.01913.00
5.3.230.0060.02013.00
5.3.220.0050.01912.99
5.3.210.0030.02412.99
5.3.200.0040.02012.99
5.3.190.0030.02312.99
5.3.180.0040.02112.99
5.3.170.0040.01812.99
5.3.160.0030.02112.99
5.3.150.0030.01812.99
5.3.140.0040.01912.98
5.3.130.0040.02212.98
5.3.120.0080.01612.98
5.3.110.0060.01812.98
5.3.100.0050.02312.80
5.3.90.0100.01512.80
5.3.80.0060.01812.79
5.3.70.0030.02412.79
5.3.60.0050.02112.79
5.3.50.0070.02212.77
5.3.40.0060.02212.77
5.3.30.0070.02112.76
5.3.20.0030.02612.69
5.3.10.0060.02212.67
5.3.00.0050.02312.67
5.2.170.0060.0479.23
5.2.160.0080.0459.23
5.2.150.0090.0439.23
5.2.140.0060.0439.23
5.2.130.0110.0449.19
5.2.120.0080.0409.19
5.2.110.0080.0399.19
5.2.100.0080.0429.19
5.2.90.0070.0429.19
5.2.80.0100.0409.18
5.2.70.0080.0419.19
5.2.60.0070.0479.14
5.2.50.0080.0479.11
5.2.40.0070.0419.08
5.2.30.0040.0469.06
5.2.20.0140.0499.04
5.2.10.0220.0708.95
5.2.00.0070.0448.82
5.1.60.0060.0388.10
5.1.50.0100.0328.10
5.1.40.0110.0348.08
5.1.30.0130.0468.43
5.1.20.0040.0388.45
5.1.10.0070.0418.18
5.1.00.0080.0488.18
5.0.50.0050.0506.65
5.0.40.0070.0316.52
5.0.30.0090.0476.32
5.0.20.0100.0446.29
5.0.10.0100.0226.27
5.0.00.0110.0566.27
4.4.90.0050.0264.78
4.4.80.0070.0284.76
4.4.70.0110.0404.76
4.4.60.0020.0244.75
4.4.50.0060.0234.77
4.4.40.0040.0434.71
4.4.30.0070.0444.76
4.4.20.0050.0394.85
4.4.10.0060.0234.85
4.4.00.0070.0364.76
4.3.110.0050.0244.67
4.3.100.0060.0234.66
4.3.90.0040.0264.63
4.3.80.0090.0334.58
4.3.70.0080.0224.63
4.3.60.0110.0184.63
4.3.50.0050.0254.63
4.3.40.0040.0474.53
4.3.30.0030.0203.30
4.3.20.0010.0243.28
4.3.10.0030.0223.24
4.3.00.0030.01013.17

preferences:
52.88 ms | 401 KiB | 5 Q