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

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.00618.43
8.3.60.0140.00316.88
8.3.50.0140.00721.99
8.3.40.0120.00618.97
8.3.30.0110.00419.01
8.3.20.0060.00920.24
8.3.10.0040.00423.71
8.3.00.0000.00819.38
8.2.180.0170.00318.55
8.2.170.0120.00322.96
8.2.160.0140.00020.35
8.2.150.0080.00024.18
8.2.140.0000.00724.66
8.2.130.0080.00026.16
8.2.120.0070.00022.02
8.2.110.0030.00622.11
8.2.100.0080.00317.91
8.2.90.0000.00819.22
8.2.80.0040.00417.97
8.2.70.0030.00617.38
8.2.60.0000.00818.05
8.2.50.0070.00218.07
8.2.40.0040.00420.07
8.2.30.0090.00018.11
8.2.20.0000.00717.64
8.2.10.0040.00418.06
8.2.00.0030.00617.64
8.1.280.0080.01225.92
8.1.270.0040.00423.97
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0000.00923.79
8.1.230.0040.00719.15
8.1.220.0000.00817.74
8.1.210.0030.00918.77
8.1.200.0060.00317.35
8.1.190.0000.00817.39
8.1.180.0040.00418.10
8.1.170.0030.00618.43
8.1.160.0000.00721.94
8.1.150.0060.00318.66
8.1.140.0040.00417.34
8.1.130.0000.00817.85
8.1.120.0000.00817.43
8.1.110.0030.00617.40
8.1.100.0040.00417.31
8.1.90.0040.00417.40
8.1.80.0040.00417.45
8.1.70.0030.00317.41
8.1.60.0030.00517.49
8.1.50.0000.00717.40
8.1.40.0040.00417.53
8.1.30.0040.00417.64
8.1.20.0080.00017.68
8.1.10.0080.00017.48
8.1.00.0000.00817.58
8.0.300.0040.00419.09
8.0.290.0060.00317.18
8.0.280.0070.00018.42
8.0.270.0030.00317.13
8.0.260.0060.00017.29
8.0.250.0070.00016.88
8.0.240.0000.00716.98
8.0.230.0030.00316.93
8.0.220.0040.00416.91
8.0.210.0080.00016.93
8.0.200.0030.00316.82
8.0.190.0040.00417.00
8.0.180.0080.00316.87
8.0.170.0030.00516.93
8.0.160.0000.00816.87
8.0.150.0000.00716.75
8.0.140.0000.00716.93
8.0.130.0030.00313.30
8.0.120.0000.00816.79
8.0.110.0000.00717.00
8.0.100.0070.00016.93
8.0.90.0040.00416.98
8.0.80.0090.00916.82
8.0.70.0070.00016.80
8.0.60.0060.00316.91
8.0.50.0070.00016.78
8.0.30.0130.00817.13
8.0.20.0130.01017.40
8.0.10.0000.00817.09
8.0.00.0060.01216.81
7.4.330.0020.00215.00
7.4.320.0050.00316.39
7.4.300.0000.00716.51
7.4.290.0030.00316.53
7.4.280.0040.00416.53
7.4.270.0000.00716.64
7.4.260.0000.00716.65
7.4.250.0000.00716.61
7.4.240.0030.00416.61
7.4.230.0000.00716.38
7.4.220.0100.01416.66
7.4.210.0120.00416.67
7.4.200.0030.00316.50
7.4.190.0070.00016.44
7.4.160.0080.00816.61
7.4.150.0170.00317.40
7.4.140.0100.01117.86
7.4.130.0080.00716.57
7.4.120.0110.00816.54
7.4.110.0040.01416.45
7.4.100.0110.00716.54
7.4.90.0090.00916.52
7.4.80.0090.00919.39
7.4.70.0120.00616.62
7.4.60.0090.01316.57
7.4.50.0050.00016.41
7.4.40.0070.01022.77
7.4.30.0090.00916.44
7.4.10.0130.00314.98
7.4.00.0090.00614.95
7.3.330.0040.00213.22
7.3.320.0000.00513.46
7.3.310.0000.00716.45
7.3.300.0040.00416.44
7.3.290.0120.00616.43
7.3.280.0070.00916.40
7.3.270.0060.01217.40
7.3.260.0130.00316.63
7.3.250.0110.00816.54
7.3.240.0090.00816.63
7.3.230.0040.01416.49
7.3.210.0110.00716.32
7.3.200.0110.01119.39
7.3.190.0100.00716.49
7.3.180.0120.00416.51
7.3.170.0140.00416.39
7.3.160.0140.00716.70
7.3.130.0070.01114.78
7.3.120.0050.01115.02
7.3.110.0060.01014.76
7.3.100.0000.01314.81
7.3.90.0090.00614.93
7.3.80.0000.01414.68
7.3.70.0030.01014.59
7.3.60.0060.00914.75
7.3.50.0070.00414.80
7.3.40.0030.00914.83
7.3.30.0060.01014.93
7.3.20.0000.01516.75
7.3.10.0030.01316.61
7.3.00.0050.00716.61
7.2.330.0040.01316.45
7.2.320.0210.00416.49
7.2.310.0060.01116.84
7.2.300.0090.00916.89
7.2.290.0100.01316.71
7.2.260.0060.01215.04
7.2.250.0120.00415.05
7.2.240.0030.01014.76
7.2.230.0140.00015.36
7.2.220.0030.00715.02
7.2.210.0070.00715.00
7.2.200.0040.01215.28
7.2.190.0120.00415.28
7.2.180.0040.01115.06
7.2.170.0030.01314.97
7.2.160.0120.00315.23
7.2.150.0080.00417.00
7.2.140.0070.00716.87
7.2.130.0070.00816.90
7.2.120.0080.00517.03
7.2.110.0020.01416.97
7.2.100.0070.00816.75
7.2.90.0040.01016.79
7.2.80.0090.00716.93
7.2.70.0080.00416.89
7.2.60.0120.00216.89
7.2.50.0020.01016.91
7.2.40.0070.00616.96
7.2.30.0040.01016.95
7.2.20.0090.00617.16
7.2.10.0060.00716.82
7.2.00.0080.00517.68
7.1.330.0030.00815.63
7.1.320.0070.00715.80
7.1.310.0030.01015.69
7.1.300.0000.01315.77
7.1.290.0000.01015.99
7.1.280.0000.01415.84
7.1.270.0100.00015.80
7.1.260.0000.01415.88
7.1.250.0020.00915.83
7.1.240.0120.00015.90
7.1.230.0100.00315.79
7.1.220.0040.00715.82
7.1.210.0000.01415.91
7.1.200.0060.00915.53
7.1.190.0080.00415.91
7.1.180.0060.00615.72
7.1.170.0030.00715.90
7.1.160.0030.01315.71
7.1.150.0090.00415.79
7.1.140.0000.01715.70
7.1.130.0040.00815.71
7.1.120.0000.01315.79
7.1.110.0000.01315.64
7.1.100.0070.00616.99
7.1.90.0050.00515.84
7.1.80.0040.01115.86
7.1.70.0050.00616.38
7.1.60.0050.01317.72
7.1.50.0080.01016.24
7.1.40.0130.00715.71
7.1.30.0060.00915.82
7.1.20.0080.00815.54
7.1.10.0040.00815.84
7.1.00.0070.03819.17
7.0.330.0060.00615.42
7.0.320.0000.01615.30
7.0.310.0110.00415.17
7.0.300.0040.00815.42
7.0.290.0070.00715.30
7.0.280.0060.00615.43
7.0.270.0040.00715.40
7.0.260.0070.00715.61
7.0.250.0000.00815.59
7.0.240.0070.00715.28
7.0.230.0070.00715.50
7.0.220.0040.01115.46
7.0.210.0030.00615.49
7.0.200.0030.00716.07
7.0.190.0030.01015.52
7.0.180.0060.01315.34
7.0.170.0080.00015.56
7.0.160.0100.00615.50
7.0.150.0110.00415.40
7.0.140.0030.03918.91
7.0.130.0100.00315.55
7.0.120.0040.00815.56
7.0.110.0030.00915.41
7.0.100.0030.01315.59
7.0.90.0060.00915.22
7.0.80.0030.01015.62
7.0.70.0070.00715.40
7.0.60.0050.03617.81
7.0.50.0070.02716.82
7.0.40.0020.03316.93
7.0.30.0210.02016.81
7.0.20.0220.02016.90
7.0.10.0200.03716.90
7.0.00.0020.04516.82
5.6.400.0070.00314.44
5.6.390.0060.00914.72
5.6.380.0030.00814.77
5.6.370.0030.00514.33
5.6.360.0040.01414.60
5.6.350.0000.00914.46
5.6.340.0030.00914.04
5.6.330.0060.00314.63
5.6.320.0110.00614.26
5.6.310.0030.00814.50
5.6.300.0100.00714.62
5.6.290.0000.01314.42
5.6.280.0020.04017.63
5.6.270.0000.01314.45
5.6.260.0090.00614.48
5.6.250.0040.01214.52
5.6.240.0140.00314.17
5.6.230.0070.00714.31
5.6.220.0070.00714.63
5.6.210.0100.02817.43
5.6.200.0060.02316.26
5.6.190.0040.03217.58
5.6.180.0180.02317.61
5.6.170.0130.04517.40
5.6.160.0020.02617.52
5.6.150.0070.02816.36
5.6.140.0070.02716.29
5.6.130.0080.02416.37
5.6.120.0060.02317.70
5.6.110.0070.02417.68
5.6.100.0070.04517.64
5.6.90.0100.04317.73
5.6.80.0100.03517.46
5.6.70.0260.03717.51
5.6.60.0090.00314.20
5.6.50.0040.00814.41
5.6.40.0030.01314.37
5.6.30.0030.00614.31
5.6.20.0000.01214.24
5.6.10.0080.00314.42
5.6.00.0040.01214.47
5.5.380.0030.01314.43
5.5.370.0040.00714.41
5.5.360.0060.00614.49
5.5.350.0070.04717.44
5.5.340.0070.03016.08
5.5.330.0070.03717.29
5.5.320.0200.03217.38
5.5.310.0200.04017.42
5.5.300.0030.04716.26
5.5.290.0070.02816.20
5.5.280.0070.04717.65
5.5.270.0020.02817.49
5.5.260.0020.02517.75
5.5.250.0090.03317.50
5.5.240.0070.03017.20
5.5.230.0060.00614.41
5.5.220.0070.00714.29
5.5.210.0060.00614.62
5.5.200.0070.00714.43
5.5.190.0040.00714.44
5.5.180.0060.00314.48
5.5.170.0030.00714.34
5.5.160.0040.01214.41
5.5.150.0070.00414.38
5.5.140.0030.01314.55
5.5.130.0070.00714.28
5.5.120.0100.00714.20
5.5.110.0030.01314.47
5.5.100.0090.00614.39
5.5.90.0090.00314.20
5.5.80.0030.01214.32
5.5.70.0070.00714.19
5.5.60.0030.01314.34
5.5.50.0070.00314.29
5.5.40.0040.00814.25
5.5.30.0090.00614.08
5.5.20.0130.00014.57
5.5.10.0090.00914.26
5.5.00.0040.01114.45
5.4.450.0440.03015.38
5.4.440.0460.02515.49
5.4.430.0130.03715.48
5.4.420.0350.03315.46
5.4.410.0450.02515.35
5.4.400.0550.03215.33
5.4.390.0480.04215.30
5.4.380.0180.02715.05
5.4.370.0120.03314.93
5.4.360.0210.02514.92
5.4.350.0130.03615.10
5.4.340.0160.03115.07
5.4.330.0100.00311.31
5.4.320.0040.02211.91
5.4.310.0060.02511.91
5.4.300.0100.02111.93
5.4.290.0040.02511.90
5.4.280.0050.02311.85
5.4.270.0030.02211.88
5.4.260.0040.02411.85
5.4.250.0040.02611.85
5.4.240.0070.01911.85
5.4.230.0060.02311.84
5.4.220.0050.02511.84
5.4.210.0050.02911.84
5.4.200.0060.02211.84
5.4.190.0040.02511.84
5.4.180.0020.02611.84
5.4.170.0070.02211.84
5.4.160.0080.02011.84
5.4.150.0060.02011.84
5.4.140.0080.01911.71
5.4.130.0080.02011.68
5.4.120.0060.02911.66
5.4.110.0090.01911.70
5.4.100.0040.02111.65
5.4.90.0020.02411.70
5.4.80.0050.02211.67
5.4.70.0020.02411.65
5.4.60.0070.02111.65
5.4.50.0040.02511.65
5.4.40.0040.02311.65
5.4.30.0040.02511.65
5.4.20.0030.02511.65
5.4.10.0040.02511.64
5.4.00.0040.02311.39
5.3.290.0040.02512.06
5.3.280.0060.02112.01
5.3.270.0060.02412.01
5.3.260.0050.02412.02
5.3.250.0080.03012.01
5.3.240.0100.02912.02
5.3.230.0070.02312.01
5.3.220.0080.02611.99
5.3.210.0080.02411.99
5.3.200.0070.02111.99
5.3.190.0060.03011.99
5.3.180.0090.02811.99
5.3.170.0100.02911.99
5.3.160.0030.03311.99
5.3.150.0080.02611.99
5.3.140.0060.02211.98
5.3.130.0050.02211.98
5.3.120.0070.02311.98
5.3.110.0020.02711.98
5.3.100.0070.02011.72
5.3.90.0060.02111.71
5.3.80.0060.02311.71
5.3.70.0070.02111.71
5.3.60.0070.01911.70
5.3.50.0020.02311.67
5.3.40.0040.02411.67
5.3.30.0070.02211.65
5.3.20.0030.02511.54
5.3.10.0060.01811.52
5.3.00.0040.02311.52
5.2.170.0070.0289.23
5.2.160.0040.0369.23
5.2.150.0060.0359.23
5.2.140.0050.0339.23
5.2.130.0090.0419.19
5.2.120.0060.0339.19
5.2.110.0070.0329.20
5.2.100.0100.0279.20
5.2.90.0070.0299.19
5.2.80.0070.0339.19
5.2.70.0060.0389.19
5.2.60.0080.0419.14
5.2.50.0040.0379.11
5.2.40.0030.0429.09
5.2.30.0060.0369.07
5.2.20.0070.0329.05
5.2.10.0100.0268.96
5.2.00.0060.0348.82
5.1.60.0030.0298.10
5.1.50.0040.0308.10
5.1.40.0060.0278.08
5.1.30.0050.0298.43
5.1.20.0060.0268.45
5.1.10.0070.0258.18
5.1.00.0040.0308.18
5.0.50.0010.0236.65
5.0.40.0040.0216.52
5.0.30.0050.0316.32
5.0.20.0020.0216.30
5.0.10.0030.0226.28
5.0.00.0040.0326.27
4.4.90.0040.0214.78
4.4.80.0030.0214.75
4.4.70.0040.0154.75
4.4.60.0040.0164.75
4.4.50.0020.0164.77
4.4.40.0040.0244.71
4.4.30.0060.0134.76
4.4.20.0030.0174.85
4.4.10.0030.0164.85
4.4.00.0040.0244.76
4.3.110.0060.0154.67
4.3.100.0040.0164.66
4.3.90.0060.0154.63
4.3.80.0070.0204.59
4.3.70.0040.0144.63
4.3.60.0040.0154.63
4.3.50.0020.0184.63
4.3.40.0050.0224.54
4.3.30.0060.0143.30
4.3.20.0030.0163.28
4.3.10.0030.0153.24
4.3.00.0070.01710.54

preferences:
42.64 ms | 401 KiB | 5 Q