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 $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]); $test[$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();

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.75
8.3.50.0180.00322.05
8.3.40.0030.01418.71
8.3.30.0140.00019.21
8.3.20.0120.00320.22
8.3.10.0080.00023.61
8.3.00.0060.00319.25
8.2.180.0070.01418.41
8.2.170.0090.00922.96
8.2.160.0070.00720.35
8.2.150.0050.00324.18
8.2.140.0050.00324.66
8.2.130.0170.00026.16
8.2.120.0080.00022.30
8.2.110.0040.00720.32
8.2.100.0040.00817.91
8.2.90.0030.00619.05
8.2.80.0000.00817.97
8.2.70.0050.00317.63
8.2.60.0100.00017.93
8.2.50.0060.00318.07
8.2.40.0050.00319.82
8.2.30.0070.00018.08
8.2.20.0000.00717.73
8.2.10.0040.00417.95
8.2.00.0030.00617.76
8.1.280.0100.00725.92
8.1.270.0040.00423.87
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0040.00423.86
8.1.230.0090.00623.73
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0090.00017.35
8.1.190.0050.00317.53
8.1.180.0060.00318.10
8.1.170.0040.00518.50
8.1.160.0070.00021.84
8.1.150.0030.00718.59
8.1.140.0070.00017.34
8.1.130.0070.00017.88
8.1.120.0050.00217.32
8.1.110.0090.00017.36
8.1.100.0000.00817.45
8.1.90.0050.00217.42
8.1.80.0000.00717.46
8.1.70.0050.00317.44
8.1.60.0040.00417.63
8.1.50.0050.00317.58
8.1.40.0090.00017.43
8.1.30.0080.00017.48
8.1.20.0050.00317.67
8.1.10.0040.00417.62
8.1.00.0040.00417.37
8.0.300.0040.00418.77
8.0.290.0000.00716.93
8.0.280.0000.00718.32
8.0.270.0040.00417.29
8.0.260.0060.00017.08
8.0.250.0000.00717.04
8.0.240.0000.00716.84
8.0.230.0040.00416.97
8.0.220.0030.00316.93
8.0.210.0050.00316.91
8.0.200.0030.00316.94
8.0.190.0040.00416.90
8.0.180.0000.00816.91
8.0.170.0000.00816.88
8.0.160.0040.00416.90
8.0.150.0040.00416.75
8.0.140.0000.00816.77
8.0.130.0050.00313.29
8.0.120.0080.00016.86
8.0.110.0000.00816.95
8.0.100.0000.00716.88
8.0.90.0000.00716.91
8.0.80.0160.00616.86
8.0.70.0080.00016.79
8.0.60.0000.00816.95
8.0.50.0000.00716.78
8.0.30.0110.01417.22
8.0.20.0120.00717.40
8.0.10.0040.00416.92
8.0.00.0110.00816.75
7.4.330.0020.00215.00
7.4.320.0030.00316.64
7.4.300.0020.00516.60
7.4.290.0040.00416.50
7.4.280.0030.00316.52
7.4.270.0090.00016.55
7.4.260.0050.00216.59
7.4.250.0040.00416.54
7.4.240.0020.00516.58
7.4.230.0000.00816.36
7.4.220.0110.00616.70
7.4.210.0090.00816.63
7.4.200.0030.00516.46
7.4.190.0070.00016.44
7.4.160.0080.00816.38
7.4.150.0130.00717.40
7.4.140.0090.00917.86
7.4.130.0030.01316.64
7.4.120.0100.01016.37
7.4.110.0210.00316.41
7.4.100.0160.00316.32
7.4.90.0040.01916.56
7.4.80.0120.01119.39
7.4.70.0090.00916.68
7.4.60.0120.00716.45
7.4.50.0090.00016.50
7.4.40.0070.00322.77
7.4.30.0060.01216.77
7.4.10.0100.00714.61
7.4.00.0080.00715.01
7.3.330.0040.00213.37
7.3.320.0000.00613.31
7.3.310.0050.00216.34
7.3.300.0000.00816.37
7.3.290.0140.00316.39
7.3.280.0050.01016.36
7.3.270.0070.01117.40
7.3.260.0130.00416.64
7.3.250.0090.00916.37
7.3.240.0030.01316.62
7.3.230.0080.00916.39
7.3.210.0090.00916.59
7.3.200.0140.00419.39
7.3.190.0080.00916.42
7.3.180.0040.01316.77
7.3.170.0030.01316.71
7.3.160.0070.01016.34
7.3.130.0100.00715.14
7.3.120.0050.00914.67
7.3.110.0040.00914.78
7.3.100.0060.00914.96
7.3.90.0040.01014.69
7.3.80.0050.00814.67
7.3.70.0060.00514.96
7.3.60.0070.00514.82
7.3.50.0050.00914.79
7.3.40.0030.00814.66
7.3.30.0030.01014.66
7.3.20.0060.00516.58
7.3.10.0080.00516.66
7.3.00.0040.00816.77
7.2.330.0120.00916.84
7.2.320.0070.01016.41
7.2.310.0090.01316.90
7.2.300.0130.00316.35
7.2.290.0090.00916.63
7.2.260.0080.01215.11
7.2.250.0090.00915.20
7.2.240.0050.01215.12
7.2.230.0080.00914.89
7.2.220.0000.01415.02
7.2.210.0050.00715.14
7.2.200.0030.00915.20
7.2.190.0020.01014.87
7.2.180.0060.00714.88
7.2.170.0090.00315.00
7.2.160.0100.00315.00
7.2.150.0070.01016.61
7.2.140.0080.00616.97
7.2.130.0030.00916.95
7.2.120.0070.00816.85
7.2.110.0080.00616.90
7.2.100.0050.00816.87
7.2.90.0050.00716.96
7.2.80.0040.00716.90
7.2.70.0030.01016.95
7.2.60.0060.00816.88
7.2.50.0040.01016.76
7.2.40.0060.00617.00
7.2.30.0060.00817.06
7.2.20.0110.00216.92
7.2.10.0100.00216.99
7.2.00.0050.00917.55
7.1.330.0010.01315.69
7.1.320.0050.00915.80
7.1.310.0070.00615.78
7.1.300.0060.00915.73
7.1.290.0030.00915.92
7.1.280.0070.00315.73
7.1.270.0040.00615.83
7.1.260.0030.00815.71
7.1.250.0060.00415.72
7.1.240.0060.00315.79
7.1.230.0030.01015.70
7.1.220.0030.01015.92
7.1.210.0030.01015.87
7.1.200.0070.00415.89
7.1.190.0100.00315.89
7.1.180.0030.00615.78
7.1.170.0000.01516.00
7.1.160.0040.00915.71
7.1.150.0030.00615.63
7.1.140.0070.00715.95
7.1.130.0030.01415.93
7.1.120.0130.00015.85
7.1.110.0070.01015.49
7.1.100.0080.00617.01
7.1.90.0120.00315.55
7.1.80.0090.00015.86
7.1.70.0050.00316.56
7.1.60.0090.00917.62
7.1.50.0020.01716.37
7.1.40.0080.00415.72
7.1.30.0040.00815.52
7.1.20.0040.00715.80
7.1.10.0060.00915.74
7.1.00.0060.04019.18
7.0.330.0030.01015.43
7.0.320.0090.00315.54
7.0.310.0080.00015.39
7.0.300.0030.00915.44
7.0.290.0000.01015.59
7.0.280.0040.01115.61
7.0.270.0070.00315.48
7.0.260.0120.00015.45
7.0.250.0100.00315.42
7.0.240.0120.00315.45
7.0.230.0000.01315.63
7.0.220.0000.01415.48
7.0.210.0070.00715.15
7.0.200.0050.00515.94
7.0.190.0030.01015.58
7.0.180.0080.00315.28
7.0.170.0030.00615.27
7.0.160.0090.00615.29
7.0.150.0070.00715.50
7.0.140.0050.03818.80
7.0.130.0000.01115.28
7.0.120.0070.00715.31
7.0.110.0060.00315.45
7.0.100.0040.00415.16
7.0.90.0000.01215.23
7.0.80.0050.00315.13
7.0.70.0000.01315.20
7.0.60.0050.02317.53
7.0.50.0050.02516.61
7.0.40.0070.03216.71
7.0.30.0290.02816.82
7.0.20.0150.02516.78
7.0.10.0170.03916.93
7.0.00.0100.04016.86
5.6.400.0030.00714.29
5.6.390.0030.00614.71
5.6.380.0100.00314.47
5.6.370.0060.00614.13
5.6.360.0040.01114.77
5.6.350.0000.01314.34
5.6.340.0070.00714.67
5.6.330.0090.00014.77
5.6.320.0040.00814.74
5.6.310.0070.00714.44
5.6.300.0040.01114.58
5.6.290.0040.00814.31
5.6.280.0070.03717.89
5.6.270.0030.01014.38
5.6.260.0000.01414.37
5.6.250.0100.00014.13
5.6.240.0090.00414.44
5.6.230.0060.00914.54
5.6.220.0160.00314.72
5.6.210.0100.02017.48
5.6.200.0080.03016.26
5.6.190.0030.04917.59
5.6.180.0220.03917.45
5.6.170.0150.03617.58
5.6.160.0160.03617.47
5.6.150.0080.03316.34
5.6.140.0060.04616.31
5.6.130.0080.04716.41
5.6.120.0120.03017.68
5.6.110.0120.03717.60
5.6.100.0080.04517.64
5.6.90.0070.03817.83
5.6.80.0020.02917.52
5.6.70.1700.02217.43
5.6.60.0150.00014.50
5.6.50.0040.01214.29
5.6.40.0070.00414.27
5.6.30.0060.00614.12
5.6.20.0060.00914.48
5.6.10.0000.00914.13
5.6.00.0070.01014.32
5.5.380.0040.00414.50
5.5.370.0100.00014.36
5.5.360.0000.01314.47
5.5.350.0050.03917.44
5.5.340.0050.02816.15
5.5.330.0100.03517.38
5.5.320.0140.02517.31
5.5.310.0120.03317.44
5.5.300.0030.04516.14
5.5.290.0060.02316.21
5.5.280.0100.03717.77
5.5.270.0050.04617.76
5.5.260.0050.05017.66
5.5.250.0080.03917.55
5.5.240.0200.04017.42
5.5.230.0030.00914.66
5.5.220.0070.00414.36
5.5.210.0100.00614.12
5.5.200.0000.01114.34
5.5.190.0030.01014.17
5.5.180.0030.01214.18
5.5.170.0030.00814.44
5.5.160.0040.00814.42
5.5.150.0040.00714.45
5.5.140.0090.00314.31
5.5.130.0070.00814.50
5.5.120.0060.00614.34
5.5.110.0070.00314.36
5.5.100.0100.00714.43
5.5.90.0040.00714.39
5.5.80.0000.01214.62
5.5.70.0040.00714.21
5.5.60.0070.00714.25
5.5.50.0070.00713.91
5.5.40.0000.01014.16
5.5.30.0070.00714.04
5.5.20.0070.00714.55
5.5.10.0040.00814.06
5.5.00.0000.01214.45
5.4.450.0150.02715.36
5.4.440.0350.03915.29
5.4.430.0350.02915.08
5.4.420.0080.02915.27
5.4.410.0090.03015.34
5.4.400.0450.03515.12
5.4.390.0440.03715.14
5.4.380.0280.02815.00
5.4.370.0070.03114.86
5.4.360.0150.02815.03
5.4.350.0130.03514.96
5.4.340.0230.02814.98
5.4.330.0030.00611.20
5.4.320.0050.02511.80
5.4.310.0040.02411.75
5.4.300.0040.02311.85
5.4.290.0060.02311.78
5.4.280.0040.02311.79
5.4.270.0050.02311.79
5.4.260.0050.02411.69
5.4.250.0020.02311.79
5.4.240.0060.02611.81
5.4.230.0020.02711.70
5.4.220.0110.01611.68
5.4.210.0030.02311.87
5.4.200.0080.02011.76
5.4.190.0090.03311.79
5.4.180.0070.02211.73
5.4.170.0040.02311.69
5.4.160.0070.02011.80
5.4.150.0090.01911.83
5.4.140.0080.02811.70
5.4.130.0050.02911.66
5.4.120.0060.02811.59
5.4.110.0080.02711.50
5.4.100.0050.03011.51
5.4.90.0080.02311.58
5.4.80.0080.01911.56
5.4.70.0070.02711.53
5.4.60.0080.02311.61
5.4.50.0040.02211.62
5.4.40.0070.01911.49
5.4.30.0050.02011.59
5.4.20.0020.02511.62
5.4.10.0070.01811.49
5.4.00.0040.02011.23
5.3.290.0050.02411.90
5.3.280.0040.02211.85
5.3.270.0070.02311.86
5.3.260.0040.02411.86
5.3.250.0070.02011.86
5.3.240.0040.02311.86
5.3.230.0060.02711.85
5.3.220.0060.02211.84
5.3.210.0050.02211.84
5.3.200.0040.02011.84
5.3.190.0020.02311.83
5.3.180.0040.02211.83
5.3.170.0040.02511.83
5.3.160.0040.02311.83
5.3.150.0070.02011.83
5.3.140.0050.02111.83
5.3.130.0060.02211.83
5.3.120.0050.03311.82
5.3.110.0020.03011.82
5.3.100.0040.03011.56
5.3.90.0040.02711.55
5.3.80.0060.02911.55
5.3.70.0040.02911.55
5.3.60.0050.02311.54
5.3.50.0040.02211.51
5.3.40.0040.02211.51
5.3.30.0080.02211.49
5.3.20.0050.02311.38
5.3.10.0030.03311.37
5.3.00.0060.02411.36
5.2.170.0050.0369.23
5.2.160.0080.0299.23
5.2.150.0080.0309.22
5.2.140.0050.0339.22
5.2.130.0070.0299.19
5.2.120.0080.0389.19
5.2.110.0080.0269.20
5.2.100.0060.0299.19
5.2.90.0050.0309.19
5.2.80.0040.0339.19
5.2.70.0050.0329.18
5.2.60.0060.0299.14
5.2.50.0060.0319.11
5.2.40.0040.0309.09
5.2.30.0040.0379.06
5.2.20.0090.0319.04
5.2.10.0060.0338.95
5.2.00.0080.0328.82
5.1.60.0060.0258.11
5.1.50.0040.0368.10
5.1.40.0050.0338.08
5.1.30.0050.0388.43
5.1.20.0080.0368.45
5.1.10.0040.0378.18
5.1.00.0070.0378.18
5.0.50.0050.0306.65
5.0.40.0060.0346.52
5.0.30.0070.0496.33
5.0.20.0060.0276.29
5.0.10.0060.0286.28
5.0.00.0060.0416.27
4.4.90.0060.0224.78
4.4.80.0040.0224.76
4.4.70.0040.0224.75
4.4.60.0060.0204.76
4.4.50.0120.0224.77
4.4.40.0070.0334.71
4.4.30.0040.0234.76
4.4.20.0020.0264.84
4.4.10.0060.0214.85
4.4.00.0060.0344.75
4.3.110.0030.0264.67
4.3.100.0090.0224.67
4.3.90.0060.0224.63
4.3.80.0040.0414.58
4.3.70.0050.0234.63
4.3.60.0040.0224.63
4.3.50.0030.0154.63
4.3.40.0050.0224.54
4.3.30.0020.0163.30
4.3.20.0030.0153.28
4.3.10.0010.0173.23
4.3.00.0070.00710.54

preferences:
67.67 ms | 400 KiB | 5 Q