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 die('here'.$key ); $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); 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.0140.00016.61
8.3.50.0110.00921.92
8.3.40.0100.00718.67
8.3.30.0140.00019.17
8.3.20.0000.00720.21
8.3.10.0050.00323.48
8.3.00.0060.00319.51
8.2.180.0070.01018.67
8.2.170.0040.01122.96
8.2.160.0150.00020.43
8.2.150.0090.00024.18
8.2.140.0090.00024.66
8.2.130.0060.01326.16
8.2.120.0080.00021.98
8.2.110.0060.00322.21
8.2.100.0090.00318.03
8.2.90.0040.00419.14
8.2.80.0030.00617.97
8.2.70.0040.00417.50
8.2.60.0080.00217.80
8.2.50.0110.00018.07
8.2.40.0000.00819.88
8.2.30.0050.00318.14
8.2.20.0040.00417.75
8.2.10.0040.00418.06
8.2.00.0030.00617.81
8.1.280.0080.01125.92
8.1.270.0060.00323.88
8.1.260.0060.00326.35
8.1.250.0070.00328.09
8.1.240.0040.00423.79
8.1.230.0070.00419.15
8.1.220.0050.00317.74
8.1.210.0040.00418.77
8.1.200.0000.00917.35
8.1.190.0000.00717.53
8.1.180.0000.00918.10
8.1.170.0030.00618.38
8.1.160.0030.00522.03
8.1.150.0050.00518.50
8.1.140.0040.00417.35
8.1.130.0080.00017.86
8.1.120.0040.00417.41
8.1.110.0080.00017.45
8.1.100.0000.00717.37
8.1.90.0030.00317.40
8.1.80.0070.00017.45
8.1.70.0000.00717.46
8.1.60.0080.00017.58
8.1.50.0000.00817.57
8.1.40.0050.00317.44
8.1.30.0080.00017.64
8.1.20.0040.00417.64
8.1.10.0000.00717.47
8.1.00.0030.00617.43
8.0.300.0000.00819.15
8.0.290.0040.00417.04
8.0.280.0000.00718.45
8.0.270.0040.00417.21
8.0.260.0030.00317.11
8.0.250.0040.00416.91
8.0.240.0030.00616.97
8.0.230.0000.00717.01
8.0.220.0070.00016.92
8.0.210.0060.00316.89
8.0.200.0030.00316.96
8.0.190.0000.00916.81
8.0.180.0070.00316.81
8.0.170.0000.00816.97
8.0.160.0040.00416.90
8.0.150.0040.00416.92
8.0.140.0030.00516.76
8.0.130.0030.00313.37
8.0.120.0030.00616.75
8.0.110.0000.00816.77
8.0.100.0040.00416.72
8.0.90.0000.00716.93
8.0.80.0170.00016.91
8.0.70.0050.00216.77
8.0.60.0050.00316.76
8.0.50.0080.00016.73
8.0.30.0110.00917.08
8.0.20.0110.01017.40
8.0.10.0000.00816.89
8.0.00.0130.00716.73
7.4.330.0020.00215.00
7.4.320.0040.00416.55
7.4.300.0030.00316.61
7.4.290.0050.00316.49
7.4.280.0000.00716.61
7.4.270.0000.00716.52
7.4.260.0000.00816.53
7.4.250.0000.00716.36
7.4.240.0030.00416.56
7.4.230.0030.00316.72
7.4.220.0060.01216.62
7.4.210.0080.01016.61
7.4.200.0000.00716.61
7.4.190.0000.00716.47
7.4.160.0170.00016.52
7.4.150.0090.00917.40
7.4.140.0100.01017.86
7.4.130.0090.00816.65
7.4.120.0060.01316.52
7.4.110.0100.01416.68
7.4.100.0060.01316.54
7.4.90.0100.00716.49
7.4.80.0110.01619.39
7.4.70.0090.00916.71
7.4.60.0030.01416.74
7.4.50.0030.00516.46
7.4.40.0120.00622.77
7.4.30.0090.00916.55
7.4.10.0080.01115.05
7.4.00.0060.01114.78
7.3.330.0030.00313.41
7.3.320.0030.00313.24
7.3.310.0000.00716.46
7.3.300.0030.00516.29
7.3.290.0070.00716.37
7.3.280.0100.00816.42
7.3.270.0130.00317.40
7.3.260.0120.01216.57
7.3.250.0110.00516.51
7.3.240.0070.01016.60
7.3.230.0140.00316.54
7.3.210.0160.00616.40
7.3.200.0130.00619.39
7.3.190.0100.01316.45
7.3.180.0060.01016.25
7.3.170.0140.00316.34
7.3.160.0090.00616.44
7.3.130.0090.00915.00
7.3.120.0070.00914.91
7.3.110.0050.01214.80
7.3.100.0050.00714.77
7.3.90.0070.00814.75
7.3.80.0030.00914.84
7.3.70.0050.00914.71
7.3.60.0050.00914.70
7.3.50.0080.00514.78
7.3.40.0040.01014.73
7.3.30.0070.00614.83
7.3.20.0080.00516.62
7.3.10.0070.00716.45
7.3.00.0060.00816.79
7.2.330.0110.00616.88
7.2.320.0140.00416.79
7.2.310.0100.00716.78
7.2.300.0100.00616.78
7.2.290.0070.01016.45
7.2.260.0130.00515.13
7.2.250.0040.01315.09
7.2.240.0040.01314.76
7.2.230.0060.01015.08
7.2.220.0040.01114.96
7.2.210.0050.00715.08
7.2.200.0050.01214.97
7.2.190.0040.00715.08
7.2.180.0030.00814.91
7.2.170.0050.00715.07
7.2.160.0040.00914.95
7.2.150.0040.01016.80
7.2.140.0060.00716.96
7.2.130.0080.00516.79
7.2.120.0010.01216.73
7.2.110.0040.01016.79
7.2.100.0030.01016.83
7.2.90.0060.00816.98
7.2.80.0030.01016.81
7.2.70.0070.00916.88
7.2.60.0040.01017.02
7.2.50.0040.01016.75
7.2.40.0070.00717.11
7.2.30.0030.00916.89
7.2.20.0060.00516.92
7.2.10.0050.00717.04
7.2.00.0030.01117.55
7.1.330.0070.00915.74
7.1.320.0040.00815.73
7.1.310.0070.00715.78
7.1.300.0030.00815.73
7.1.290.0040.00815.79
7.1.280.0070.00715.70
7.1.270.0050.00715.80
7.1.260.0060.00815.65
7.1.250.0080.00715.84
7.1.240.0090.00315.84
7.1.230.0060.00315.81
7.1.220.0040.00915.87
7.1.210.0020.01015.60
7.1.200.0020.01115.75
7.1.190.0050.00515.75
7.1.180.0060.00815.77
7.1.170.0040.01115.84
7.1.160.0070.00515.77
7.1.150.0060.00515.98
7.1.140.0090.00515.88
7.1.130.0030.00715.79
7.1.120.0080.00315.70
7.1.110.0030.00815.90
7.1.100.0070.00816.56
7.1.90.0080.00615.74
7.1.80.0050.00515.78
7.1.70.0030.00816.22
7.1.60.0070.00916.24
7.1.50.0070.00916.18
7.1.40.0020.01015.73
7.1.30.0050.00815.72
7.1.20.0050.00715.91
7.1.10.0040.00915.73
7.1.00.0070.03017.97
7.0.330.0070.00515.20
7.0.320.0030.01215.35
7.0.310.0030.00615.44
7.0.300.0040.00915.41
7.0.290.0060.00615.33
7.0.280.0050.00815.24
7.0.270.0040.00915.35
7.0.260.0050.00815.31
7.0.250.0020.01115.37
7.0.240.0080.00415.44
7.0.230.0020.01215.52
7.0.220.0050.00815.42
7.0.210.0050.00915.49
7.0.200.0060.00715.84
7.0.190.0070.00715.43
7.0.180.0060.00315.51
7.0.170.0040.00715.36
7.0.160.0060.00615.21
7.0.150.0070.00715.52
7.0.140.0030.02917.60
7.0.130.0050.00815.41
7.0.120.0060.00415.47
7.0.110.0080.00315.38
7.0.100.0080.00615.29
7.0.90.0050.00815.48
7.0.80.0030.00815.50
7.0.70.0040.01115.42
7.0.60.0110.02616.78
7.0.50.0050.03016.25
7.0.40.0060.01815.79
7.0.30.0290.02615.74
7.0.20.0120.02815.56
7.0.10.0070.03215.65
7.0.00.0070.03215.57
5.6.400.0090.00514.56
5.6.390.0080.00614.31
5.6.380.0050.01014.73
5.6.370.0030.01214.50
5.6.360.0080.00614.55
5.6.350.0070.00414.28
5.6.340.0090.00514.46
5.6.330.0030.00914.63
5.6.320.0050.00814.60
5.6.310.0030.01014.51
5.6.300.0050.00914.74
5.6.290.0050.01114.47
5.6.280.0050.02916.57
5.6.270.0090.00714.32
5.6.260.0050.01014.46
5.6.250.0040.01014.72
5.6.240.0050.00914.49
5.6.230.0030.01014.64
5.6.220.0050.00814.47
5.6.210.0030.03516.47
5.6.200.0050.02015.78
5.6.190.0050.03616.59
5.6.180.0110.03116.55
5.6.170.0170.02116.50
5.6.160.0060.03216.43
5.6.150.0040.02415.79
5.6.140.0060.02915.57
5.6.130.0080.02815.63
5.6.120.0020.03416.66
5.6.110.0080.03116.73
5.6.100.0040.03416.72
5.6.90.0070.02816.58
5.6.80.0040.01916.36
5.6.70.1550.01816.42
5.6.60.0060.00714.38
5.6.50.0050.00614.42
5.6.40.0010.01314.49
5.6.30.0050.00714.27
5.6.20.0040.00814.49
5.6.10.0080.00714.27
5.6.00.0050.01314.30
5.5.380.0010.01014.23
5.5.370.0030.00614.43
5.5.360.0080.00614.46
5.5.350.0100.03016.40
5.5.340.0070.03015.54
5.5.330.0090.02116.43
5.5.320.0140.01916.25
5.5.310.0140.01916.38
5.5.300.0030.03315.58
5.5.290.0080.01715.61
5.5.280.0040.02216.60
5.5.270.0020.03616.53
5.5.260.0060.03216.53
5.5.250.0070.03216.49
5.5.240.0150.02816.26
5.5.230.0040.00714.33
5.5.220.0070.00314.37
5.5.210.0060.00414.38
5.5.200.0050.01114.38
5.5.190.0030.00914.28
5.5.180.0050.00714.39
5.5.170.0050.01014.38
5.5.160.0040.00814.33
5.5.150.0090.00914.24
5.5.140.0110.00514.24
5.5.130.0040.00914.45
5.5.120.0110.00314.24
5.5.110.0030.01214.51
5.5.100.0030.00814.46
5.5.90.0020.01414.18
5.5.80.0000.01114.34
5.5.70.0060.00914.46
5.5.60.0050.00714.27
5.5.50.0030.01114.29
5.5.40.0020.01314.50
5.5.30.0080.00614.50
5.5.20.0050.00814.31
5.5.10.0030.01214.22
5.5.00.0060.00814.17
5.4.450.0240.02714.18
5.4.440.0290.02014.15
5.4.430.0330.02114.13
5.4.420.0110.02414.29
5.4.410.0260.01914.11
5.4.400.0220.02414.15
5.4.390.0200.02014.07
5.4.380.0160.02013.88
5.4.370.0340.02613.92
5.4.360.0120.02313.99
5.4.350.0110.02913.99
5.4.340.0180.02113.86
5.4.330.0030.00711.67
5.4.320.0040.01811.89
5.4.310.0050.01811.91
5.4.300.0040.01811.76
5.4.290.0040.01811.89
5.4.280.0050.01811.89
5.4.270.0050.01611.81
5.4.260.0040.01811.90
5.4.250.0050.01811.84
5.4.240.0040.01711.83
5.4.230.0040.01711.89
5.4.220.0060.01611.87
5.4.210.0040.01611.85
5.4.200.0040.01611.79
5.4.190.0050.01511.81
5.4.180.0030.01811.82
5.4.170.0060.01511.89
5.4.160.0050.01611.79
5.4.150.0050.01611.75
5.4.140.0050.01611.68
5.4.130.0080.01411.70
5.4.120.0050.01611.85
5.4.110.0090.01411.66
5.4.100.0060.01611.77
5.4.90.0050.02011.68
5.4.80.0060.02411.69
5.4.70.0050.02211.66
5.4.60.0080.01911.78
5.4.50.0060.02011.72
5.4.40.0040.02011.67
5.4.30.0060.02011.74
5.4.20.0070.02011.79
5.4.10.0070.02011.70
5.4.00.0060.01911.57
5.3.290.0080.01611.81
5.3.280.0060.02011.68
5.3.270.0040.02411.71
5.3.260.0040.02111.77
5.3.250.0050.01911.75
5.3.240.0040.02311.75
5.3.230.0060.02111.73
5.3.220.0050.01911.73
5.3.210.0030.02111.77
5.3.200.0040.01711.79
5.3.190.0080.01811.81
5.3.180.0040.02611.81
5.3.170.0060.02311.75
5.3.160.0060.02511.79
5.3.150.0050.02211.78
5.3.140.0060.02211.69
5.3.130.0080.02811.71
5.3.120.0070.01811.79
5.3.110.0040.01811.79
5.3.100.0050.01511.61
5.3.90.0050.01611.61
5.3.80.0040.01711.60
5.3.70.0050.01711.54
5.3.60.0060.01511.53
5.3.50.0040.01511.59
5.3.40.0070.01611.51
5.3.30.0050.01611.41
5.3.20.0040.02111.36
5.3.10.0060.01611.34
5.3.00.0040.01611.30
5.2.170.0030.0339.23
5.2.160.0080.0259.23
5.2.150.0060.0299.23
5.2.140.0060.0309.23
5.2.130.0070.0359.19
5.2.120.0050.0299.19
5.2.110.0060.0289.19
5.2.100.0030.0339.19
5.2.90.0080.0299.19
5.2.80.0030.0369.18
5.2.70.0070.0349.18
5.2.60.0060.0309.14
5.2.50.0060.0339.11
5.2.40.0090.0379.09
5.2.30.0070.0379.05
5.2.20.0030.0359.05
5.2.10.0040.0318.95
5.2.00.0040.0318.82
5.1.60.0030.0278.10
5.1.50.0030.0338.09
5.1.40.0010.0298.08
5.1.30.0060.0258.42
5.1.20.0040.0288.45
5.1.10.0030.0288.18
5.1.00.0080.0238.17
5.0.50.0050.0216.65
5.0.40.0050.0206.51
5.0.30.0040.0446.32
5.0.20.0070.0246.29
5.0.10.0070.0196.27
5.0.00.0090.0416.26
4.4.90.0040.0204.78
4.4.80.0040.0164.76
4.4.70.0020.0174.75
4.4.60.0030.0174.75
4.4.50.0030.0164.77
4.4.40.0040.0254.71
4.4.30.0040.0164.76
4.4.20.0050.0154.84
4.4.10.0050.0174.85
4.4.00.0050.0304.76
4.3.110.0060.0164.66
4.3.100.0020.0194.66
4.3.90.0060.0194.64
4.3.80.0050.0304.58
4.3.70.0030.0154.63
4.3.60.0060.0184.63
4.3.50.0030.0234.63
4.3.40.0030.0334.54
4.3.30.0070.0283.30
4.3.20.0020.0283.28
4.3.10.0030.0203.23
4.3.00.0200.03010.54

preferences:
37.31 ms | 401 KiB | 5 Q