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; $test->__set($array[$first_key] , $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.70.0090.00916.63
8.3.60.0120.00416.75
8.3.50.0260.00521.98
8.3.40.0130.00718.88
8.3.30.0070.00719.25
8.3.20.0040.00420.16
8.3.10.0040.00423.65
8.3.00.0080.00019.38
8.2.180.0090.00625.92
8.2.170.0040.01119.12
8.2.160.0080.00822.96
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0000.01826.16
8.2.120.0040.00422.08
8.2.110.0150.00420.94
8.2.100.0120.00017.91
8.2.90.0040.00417.75
8.2.80.0030.00517.97
8.2.70.0060.00318.03
8.2.60.0000.01117.80
8.2.50.0040.00818.07
8.2.40.0030.00619.88
8.2.30.0050.00218.15
8.2.20.0000.00717.71
8.2.10.0000.00718.02
8.2.00.0030.00617.77
8.1.280.0140.00725.92
8.1.270.0040.00423.83
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0030.00622.19
8.1.230.0040.01118.82
8.1.220.0080.00017.79
8.1.210.0030.00518.77
8.1.200.0000.01017.47
8.1.190.0040.00417.35
8.1.180.0110.00019.01
8.1.170.0000.00818.64
8.1.160.0000.00721.98
8.1.150.0000.00818.61
8.1.140.0000.00717.35
8.1.130.0030.00517.86
8.1.120.0000.00717.43
8.1.110.0030.00617.46
8.1.100.0050.00217.48
8.1.90.0040.00417.34
8.1.80.0000.00717.43
8.1.70.0030.00317.38
8.1.60.0080.00017.60
8.1.50.0000.00817.48
8.1.40.0050.00217.55
8.1.30.0040.00417.57
8.1.20.0050.00217.68
8.1.10.0040.00417.49
8.1.00.0050.00317.51
8.0.300.0000.00719.73
8.0.290.0070.00016.75
8.0.280.0040.00418.32
8.0.270.0050.00217.14
8.0.260.0030.00317.13
8.0.250.0000.00816.92
8.0.240.0040.00416.98
8.0.230.0040.00416.96
8.0.220.0030.00316.93
8.0.210.0030.00816.92
8.0.200.0000.00617.05
8.0.190.0060.00316.85
8.0.180.0100.00016.85
8.0.170.0030.00516.98
8.0.160.0000.00717.05
8.0.150.0040.00416.87
8.0.140.0000.00716.91
8.0.130.0000.00613.28
8.0.120.0060.00316.92
8.0.110.0040.00416.96
8.0.100.0000.00716.88
8.0.90.0040.00416.77
8.0.80.0070.01316.91
8.0.70.0040.00416.88
8.0.60.0000.00916.82
8.0.50.0050.00216.72
8.0.30.0090.01117.28
8.0.20.0140.00517.40
8.0.10.0030.00517.02
8.0.00.0140.00516.72
7.4.330.0050.00015.00
7.4.320.0020.00516.43
7.4.300.0030.00316.45
7.4.290.0030.00316.63
7.4.280.0000.00716.43
7.4.270.0000.00716.55
7.4.260.0040.00416.67
7.4.250.0040.00416.45
7.4.240.0020.00516.50
7.4.230.0000.00716.54
7.4.220.0130.01316.58
7.4.210.0050.01216.61
7.4.200.0040.00416.73
7.4.190.0050.00216.57
7.4.160.0140.00316.53
7.4.150.0090.00917.40
7.4.140.0090.00917.86
7.4.130.0070.01116.60
7.4.120.0100.01216.49
7.4.110.0110.00716.75
7.4.100.0110.00616.66
7.4.90.0080.00816.57
7.4.80.0090.00919.39
7.4.70.0110.00516.66
7.4.60.0080.01416.71
7.4.50.0000.00816.50
7.4.40.0060.01022.77
7.4.30.0140.01016.59
7.4.10.0080.01016.42
7.4.00.0050.01215.84
7.3.330.0000.00713.44
7.3.320.0050.00013.31
7.3.310.0070.00016.55
7.3.300.0040.00416.45
7.3.290.0110.00316.42
7.3.280.0080.01116.44
7.3.270.0090.00917.40
7.3.260.0090.00916.53
7.3.250.0110.00616.58
7.3.240.0060.01216.70
7.3.230.0170.00616.45
7.3.210.0080.00916.58
7.3.200.0100.01019.39
7.3.190.0110.00716.46
7.3.180.0060.00916.35
7.3.170.0070.01016.64
7.3.160.0070.01216.46
7.3.130.0050.01116.41
7.3.120.0090.00815.84
7.3.110.0120.00616.45
7.3.100.0020.01216.40
7.3.90.0050.00816.32
7.3.80.0070.00316.30
7.3.70.0070.00716.41
7.3.60.0030.01216.38
7.3.50.0090.00716.38
7.3.40.0030.01216.43
7.3.30.0070.00816.25
7.3.20.0080.00817.27
7.3.10.0030.01317.18
7.3.00.0070.00517.16
7.2.330.0090.00916.59
7.2.320.0030.01416.39
7.2.310.0100.01016.76
7.2.300.0120.00416.73
7.2.290.0070.01016.75
7.2.260.0080.01116.48
7.2.250.0110.00716.56
7.2.240.0080.00816.56
7.2.230.0030.01116.59
7.2.220.0060.01016.49
7.2.210.0030.01116.35
7.2.200.0020.01116.49
7.2.190.0070.00716.46
7.2.180.0060.01116.40
7.2.170.0100.00316.37
7.2.160.0050.00816.51
7.2.150.0070.00817.46
7.2.140.0030.01117.43
7.2.130.0050.00717.47
7.2.120.0070.01017.31
7.2.110.0100.00317.28
7.2.100.0080.00717.39
7.2.90.0070.00917.32
7.2.80.0080.00617.43
7.2.70.0020.00917.34
7.2.60.0070.00917.34
7.2.50.0060.01117.45
7.2.40.0080.00517.44
7.2.30.0080.00617.46
7.2.20.0050.01117.33
7.2.10.0040.00717.42
7.2.00.0070.00818.15
7.1.330.0030.00916.94
7.1.320.0030.00716.75
7.1.310.0040.00716.92
7.1.300.0070.00916.90
7.1.290.0080.01016.93
7.1.280.0090.00316.87
7.1.270.0010.00916.83
7.1.260.0100.00316.87
7.1.250.0040.00716.84
7.1.240.0040.00916.94
7.1.230.0070.00416.79
7.1.220.0070.00816.95
7.1.210.0080.00316.91
7.1.200.0070.00516.46
7.1.190.0050.00916.86
7.1.180.0100.00516.71
7.1.170.0070.00716.84
7.1.160.0070.00716.92
7.1.150.0090.00516.85
7.1.140.0060.00716.87
7.1.130.0060.00616.82
7.1.120.0070.00716.87
7.1.110.0040.00716.88
7.1.100.0030.00916.94
7.1.90.0030.00916.93
7.1.80.0030.00616.83
7.1.70.0040.00716.94
7.1.60.0060.01017.00
7.1.50.0070.00716.78
7.1.40.0050.00716.83
7.1.30.0050.00816.71
7.1.20.0070.00716.95
7.1.10.0060.00616.75
7.1.00.0030.03118.72
7.0.330.0030.01016.60
7.0.320.0060.00516.62
7.0.310.0050.00716.60
7.0.300.0060.00816.64
7.0.290.0040.00616.62
7.0.280.0060.00716.57
7.0.270.0060.00616.51
7.0.260.0030.00716.66
7.0.250.0020.01216.57
7.0.240.0030.00816.69
7.0.230.0060.00416.62
7.0.220.0070.00516.72
7.0.210.0050.00916.75
7.0.200.0050.00516.70
7.0.190.0060.00616.68
7.0.180.0050.00516.65
7.0.170.0040.00716.50
7.0.160.0050.00516.59
7.0.150.0050.00516.57
7.0.140.0060.02918.50
7.0.130.0050.00516.70
7.0.120.0040.00916.59
7.0.110.0060.00916.50
7.0.100.0050.00516.70
7.0.90.0080.00616.68
7.0.80.0040.00916.68
7.0.70.0070.00716.65
7.0.60.0130.02617.74
7.0.50.0060.02117.12
7.0.40.0080.03217.14
7.0.30.0180.02817.24
7.0.20.0140.01717.15
7.0.10.0040.01917.07
7.0.00.0090.02817.18
5.6.400.0050.00816.33
5.6.390.0040.00716.06
5.6.380.0020.00816.22
5.6.370.0050.00616.18
5.6.360.0100.00216.02
5.6.350.0070.00716.28
5.6.340.0070.00716.29
5.6.330.0030.01016.31
5.6.320.0100.00516.28
5.6.310.0000.01216.19
5.6.300.0050.01016.26
5.6.290.0040.00516.26
5.6.280.0060.02717.72
5.6.270.0030.00716.05
5.6.260.0040.00916.25
5.6.250.0030.01216.13
5.6.240.0100.00516.17
5.6.230.0050.00616.17
5.6.220.0050.00816.23
5.6.210.0090.02317.74
5.6.200.0060.03116.91
5.6.190.0090.01817.78
5.6.180.0130.02717.54
5.6.170.0160.03017.62
5.6.160.0060.02317.65
5.6.150.0030.02316.89
5.6.140.0050.02016.88
5.6.130.0060.02316.80
5.6.120.0070.02217.83
5.6.110.0070.02017.86
5.6.100.0060.03017.85
5.6.90.0070.02117.80
5.6.80.0100.02917.50
5.6.70.1570.01817.59
5.6.60.0080.00616.12
5.6.50.0030.00716.12
5.6.40.0090.00316.09
5.6.30.0060.00816.17
5.6.20.0050.00816.08
5.6.10.0020.01016.02
5.6.00.0030.01216.15
5.5.380.0040.00916.12
5.5.370.0060.00916.20
5.5.360.0020.00816.22
5.5.350.0130.01817.56
5.5.340.0070.03116.71
5.5.330.0060.02217.43
5.5.320.0140.03417.47
5.5.310.0130.02717.55
5.5.300.0050.03016.81
5.5.290.0060.01916.68
5.5.280.0090.01917.81
5.5.270.0070.01917.57
5.5.260.0090.03117.77
5.5.250.0120.03017.61
5.5.240.0070.01917.42
5.5.230.0060.00616.15
5.5.220.0070.00516.13
5.5.210.0000.01416.01
5.5.200.0050.00616.11
5.5.190.0090.00716.05
5.5.180.0060.00816.10
5.5.170.0050.00716.06
5.5.160.0040.01116.19
5.5.150.0040.00816.09
5.5.140.0070.00715.96
5.5.130.0070.00716.05
5.5.120.0090.00716.10
5.5.110.0090.00815.96
5.5.100.0060.00816.10
5.5.90.0070.00815.98
5.5.80.0050.00716.12
5.5.70.0040.01116.16
5.5.60.0070.00516.12
5.5.50.0070.00716.20
5.5.40.0100.00616.02
5.5.30.0010.00816.02
5.5.20.0040.00916.13
5.5.10.0070.00516.06
5.5.00.0090.00516.14
5.4.450.0340.01916.24
5.4.440.0290.02716.19
5.4.430.0130.02716.12
5.4.420.0060.02416.14
5.4.410.0270.02516.19
5.4.400.0290.02116.02
5.4.390.0270.02816.12
5.4.380.0180.02515.84
5.4.370.0160.02015.89
5.4.360.0140.02615.80
5.4.350.0130.02115.83
5.4.340.0150.01715.86
5.4.330.0030.00714.52
5.4.320.0050.01613.91
5.4.310.0040.01813.85
5.4.300.0030.01813.84
5.4.290.0070.01713.86
5.4.280.0040.01613.84
5.4.270.0040.01913.82
5.4.260.0060.01613.83
5.4.250.0030.01813.85
5.4.240.0040.01813.68
5.4.230.0040.01913.82
5.4.220.0060.01713.71
5.4.210.0080.01413.68
5.4.200.0060.01713.71
5.4.190.0080.01413.83
5.4.180.0050.01513.87
5.4.170.0030.01813.80
5.4.160.0060.01613.81
5.4.150.0050.01713.79
5.4.140.0040.02213.61
5.4.130.0100.01713.71
5.4.120.0040.01713.62
5.4.110.0050.01813.76
5.4.100.0080.01813.66
5.4.90.0070.01913.68
5.4.80.0030.01913.60
5.4.70.0050.01913.70
5.4.60.0070.02113.62
5.4.50.0070.01813.72
5.4.40.0080.02513.68
5.4.30.0040.01913.71
5.4.20.0060.01613.59
5.4.10.0040.02313.58
5.4.00.0030.01913.43
5.3.290.0050.01813.81
5.3.280.0070.01613.77
5.3.270.0040.01813.78
5.3.260.0040.01713.80
5.3.250.0040.02113.78
5.3.240.0060.01913.75
5.3.230.0070.02713.76
5.3.220.0050.02113.75
5.3.210.0080.01913.75
5.3.200.0080.02013.76
5.3.190.0030.02113.81
5.3.180.0080.01313.73
5.3.170.0040.01513.80
5.3.160.0040.01613.81
5.3.150.0030.01913.82
5.3.140.0050.01613.80
5.3.130.0030.02213.80
5.3.120.0060.02013.77
5.3.110.0060.01913.68
5.3.100.0080.01513.59
5.3.90.0060.01413.57
5.3.80.0040.01613.53
5.3.70.0070.01413.46
5.3.60.0030.01813.46
5.3.50.0060.01413.56
5.3.40.0030.01913.55
5.3.30.0050.01413.54
5.3.20.0020.01713.41
5.3.10.0030.01613.38
5.3.00.0040.01513.35
5.2.170.0060.0319.23
5.2.160.0050.0319.23
5.2.150.0030.0339.23
5.2.140.0070.0439.23
5.2.130.0020.0349.19
5.2.120.0030.0319.19
5.2.110.0050.0399.20
5.2.100.0060.0279.20
5.2.90.0100.0259.19
5.2.80.0050.0319.18
5.2.70.0040.0329.19
5.2.60.0030.0329.14
5.2.50.0050.0309.11
5.2.40.0050.0299.09
5.2.30.0040.0349.06
5.2.20.0080.0279.05
5.2.10.0020.0438.95
5.2.00.0050.0428.82
5.1.60.0030.0388.10
5.1.50.0070.0268.10
5.1.40.0060.0258.08
5.1.30.0070.0238.43
5.1.20.0050.0308.45
5.1.10.0040.0308.18
5.1.00.0150.0528.18
5.0.50.0050.0296.65
5.0.40.0070.0266.52
5.0.30.0030.0446.32
5.0.20.0040.0206.29
5.0.10.0030.0206.28
5.0.00.0060.0296.27
4.4.90.0040.0154.78
4.4.80.0020.0174.76
4.4.70.0020.0174.75
4.4.60.0020.0174.76
4.4.50.0020.0164.77
4.4.40.0030.0264.71
4.4.30.0020.0154.76
4.4.20.0030.0164.84
4.4.10.0050.0214.85
4.4.00.0050.0264.76
4.3.110.0030.0174.67
4.3.100.0000.0184.67
4.3.90.0030.0154.64
4.3.80.0060.0284.58
4.3.70.0060.0194.63
4.3.60.0050.0214.63
4.3.50.0030.0244.63
4.3.40.0090.0384.54
4.3.30.0040.0273.30
4.3.20.0060.0293.28
4.3.10.0060.0343.24
4.3.00.0130.02010.54

preferences:
47.59 ms | 401 KiB | 5 Q