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; public $testy; 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; print_r($test->testy);die(); // start editing here class Intercept { public function getKey($test) { $array = (array) $test; reset($array); $first_key = key($array); print_r($array[$first_key]); $blah = array(); $test->__set($array[$first_key] , $blah[0]['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.0110.00316.75
8.3.50.0120.00921.98
8.3.40.0150.00318.71
8.3.30.0120.00319.09
8.3.20.0070.00020.24
8.3.10.0040.00423.53
8.3.00.0030.00619.26
8.2.180.0130.00618.41
8.2.170.0100.00722.96
8.2.160.0080.00620.52
8.2.150.0050.00324.18
8.2.140.0070.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00422.00
8.2.110.0030.00622.29
8.2.100.0110.00017.78
8.2.90.0030.00518.92
8.2.80.0030.00517.97
8.2.70.0060.00317.50
8.2.60.0060.00317.93
8.2.50.0060.00318.07
8.2.40.0040.00419.94
8.2.30.0070.00017.91
8.2.20.0030.00617.78
8.2.10.0040.00418.08
8.2.00.0060.00317.83
8.1.280.0070.01125.92
8.1.270.0060.00322.16
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0030.00623.84
8.1.230.0000.01119.01
8.1.220.0040.00417.74
8.1.210.0050.00318.77
8.1.200.0030.00617.38
8.1.190.0040.00417.55
8.1.180.0090.00018.10
8.1.170.0100.00518.36
8.1.160.0000.00721.83
8.1.150.0000.00918.69
8.1.140.0030.00617.42
8.1.130.0070.00017.32
8.1.120.0000.00717.33
8.1.110.0040.00417.41
8.1.100.0000.00717.34
8.1.90.0000.00717.42
8.1.80.0000.00717.34
8.1.70.0000.00717.35
8.1.60.0040.00417.52
8.1.50.0000.00817.46
8.1.40.0040.00417.45
8.1.30.0030.00517.62
8.1.20.0000.00817.67
8.1.10.0030.00517.60
8.1.00.0000.00717.46
8.0.300.0000.00718.77
8.0.290.0070.00017.16
8.0.280.0000.00718.37
8.0.270.0000.00717.23
8.0.260.0040.00416.85
8.0.250.0040.00416.88
8.0.240.0070.00016.85
8.0.230.0030.00316.92
8.0.220.0040.00416.81
8.0.210.0090.00016.95
8.0.200.0030.00316.87
8.0.190.0000.00816.96
8.0.180.0040.00416.89
8.0.170.0080.00016.82
8.0.160.0040.00416.91
8.0.150.0000.00716.87
8.0.140.0050.00316.74
8.0.130.0000.00913.36
8.0.120.0040.00416.96
8.0.110.0000.00716.87
8.0.100.0070.00016.98
8.0.90.0040.00416.83
8.0.80.0040.01116.82
8.0.70.0040.00416.94
8.0.60.0000.00816.98
8.0.50.0050.00216.96
8.0.30.0100.01217.15
8.0.20.0130.00917.40
8.0.10.0000.00716.94
8.0.00.0110.01016.79
7.4.330.0050.00015.00
7.4.320.0030.00316.62
7.4.300.0030.00316.44
7.4.290.0020.00516.40
7.4.280.0030.00316.57
7.4.270.0040.00416.40
7.4.260.0000.00816.57
7.4.250.0000.00816.43
7.4.240.0000.00716.57
7.4.230.0050.00216.66
7.4.220.0110.00716.43
7.4.210.0090.01016.55
7.4.200.0030.00316.37
7.4.190.0000.00716.37
7.4.160.0060.01116.32
7.4.150.0060.01117.40
7.4.140.0080.00917.86
7.4.130.0100.00716.39
7.4.120.0110.00616.57
7.4.110.0030.01316.38
7.4.100.0100.00716.36
7.4.90.0110.00616.51
7.4.80.0140.00919.39
7.4.70.0120.01216.54
7.4.60.0130.00316.48
7.4.50.0070.00316.38
7.4.40.0060.01022.77
7.4.30.0140.00716.15
7.4.10.0120.00216.38
7.4.00.0100.00515.79
7.3.330.0000.00613.12
7.3.320.0000.00513.02
7.3.310.0030.00316.32
7.3.300.0090.00016.30
7.3.290.0040.01116.27
7.3.280.0110.00616.23
7.3.270.0060.01017.40
7.3.260.0090.01316.41
7.3.250.0100.00916.32
7.3.240.0100.00616.20
7.3.230.0070.01016.44
7.3.210.0130.00316.17
7.3.200.0070.01119.39
7.3.190.0070.01416.53
7.3.180.0090.00616.17
7.3.170.0090.00616.50
7.3.160.0060.00916.13
7.3.130.0060.01216.32
7.3.120.0050.01315.40
7.3.110.0030.01416.43
7.3.100.0150.00316.11
7.3.90.0080.00316.10
7.3.80.0060.00916.22
7.3.70.0030.00716.23
7.3.60.0060.00616.12
7.3.50.0030.01216.24
7.3.40.0150.00016.18
7.3.30.0040.00716.15
7.3.20.0070.01118.07
7.3.10.0090.00917.31
7.3.00.0110.00517.27
7.2.330.0120.00616.80
7.2.320.0090.00916.68
7.2.310.0140.00416.71
7.2.300.0070.01016.39
7.2.290.0080.00816.63
7.2.260.0060.00916.44
7.2.250.0110.00716.53
7.2.240.0100.00716.73
7.2.230.0070.01416.31
7.2.220.0030.01216.68
7.2.210.0040.00716.63
7.2.200.0120.00016.71
7.2.190.0100.00616.31
7.2.180.0080.00816.60
7.2.170.0040.00716.58
7.2.160.0080.00416.68
7.2.150.0070.00718.23
7.2.140.0040.00818.24
7.2.130.0120.00817.46
7.2.120.0050.00917.42
7.2.110.0070.00517.42
7.2.100.0040.01017.38
7.2.90.0110.01117.51
7.2.80.0160.00917.52
7.2.70.0080.00817.81
7.2.60.0090.00717.36
7.2.50.0070.00917.50
7.2.40.0020.01017.46
7.2.30.0140.00817.58
7.2.20.0040.00717.53
7.2.10.0060.01017.39
7.2.00.0080.00518.14
7.1.330.0070.00317.29
7.1.320.0060.00917.32
7.1.310.0140.00317.51
7.1.300.0040.00817.29
7.1.290.0110.00417.26
7.1.280.0060.00617.28
7.1.270.0070.01117.25
7.1.260.0030.01017.16
7.1.250.0080.00616.30
7.1.240.0060.00617.32
7.1.230.0040.00417.19
7.1.220.0000.01017.47
7.1.210.0070.00417.13
7.1.200.0070.00616.44
7.1.190.0040.01117.36
7.1.180.0080.00417.27
7.1.170.0060.00917.22
7.1.160.0070.00717.37
7.1.150.0000.01317.35
7.1.140.0000.01517.26
7.1.130.0070.00717.13
7.1.120.0090.00617.43
7.1.110.0040.01217.21
7.1.100.0130.00517.55
7.1.90.0070.01117.29
7.1.80.0100.00517.29
7.1.70.0140.00316.91
7.1.60.0070.01218.32
7.1.50.0100.00817.08
7.1.40.0030.00717.39
7.1.30.0050.00517.17
7.1.20.0070.00717.39
7.1.10.0040.01217.28
7.1.00.0050.04119.79
7.0.330.0120.00016.81
7.0.320.0070.00716.93
7.0.310.0070.00716.93
7.0.300.0040.00717.00
7.0.290.0030.01416.95
7.0.280.0030.00916.95
7.0.270.0080.00816.96
7.0.260.0070.00416.86
7.0.250.0060.00917.13
7.0.240.0060.00917.13
7.0.230.0100.00316.98
7.0.220.0000.01517.14
7.0.210.0070.00717.08
7.0.200.0050.00716.81
7.0.190.0110.00716.82
7.0.180.0080.00617.05
7.0.170.0020.01317.02
7.0.160.0040.01217.01
7.0.150.0070.00417.15
7.0.140.0070.03919.53
7.0.130.0060.00617.12
7.0.120.0000.01516.89
7.0.110.0120.00316.96
7.0.100.0030.01017.00
7.0.90.0000.01016.92
7.0.80.0070.00716.89
7.0.70.0150.00017.02
7.0.60.0090.02118.40
7.0.50.0120.03417.33
7.0.40.0090.04617.51
7.0.30.0100.02917.57
7.0.20.0120.03017.60
7.0.10.0050.02417.52
7.0.00.0060.02417.54
5.6.400.0000.01215.57
5.6.390.0040.00715.76
5.6.380.0030.01215.90
5.6.370.0040.01115.82
5.6.360.0040.01115.81
5.6.350.0030.01315.71
5.6.340.0040.01116.05
5.6.330.0180.00015.76
5.6.320.0080.00816.08
5.6.310.0000.01415.99
5.6.300.0030.01015.75
5.6.290.0040.01115.71
5.6.280.0030.04118.54
5.6.270.0060.00815.71
5.6.260.0100.00315.61
5.6.250.0030.01015.82
5.6.240.0030.01015.59
5.6.230.0000.01315.85
5.6.220.0120.00615.75
5.6.210.0080.04518.32
5.6.200.0090.04517.00
5.6.190.0060.04718.06
5.6.180.0080.03018.33
5.6.170.0160.03618.23
5.6.160.0080.04418.20
5.6.150.0050.03017.01
5.6.140.0100.04017.02
5.6.130.0030.02516.98
5.6.120.0120.03718.49
5.6.110.0070.04518.32
5.6.100.0070.04518.43
5.6.90.0110.04318.38
5.6.80.0080.04318.04
5.6.70.2230.02518.05
5.6.60.0160.00015.62
5.6.50.0070.00715.68
5.6.40.0110.00415.75
5.6.30.0060.00915.79
5.6.20.0000.01315.70
5.6.10.0040.01115.59
5.6.00.0040.01115.79
5.5.380.0130.01315.63
5.5.370.0240.00015.76
5.5.360.0050.01815.63
5.5.350.0150.02118.01
5.5.340.0080.02716.94
5.5.330.0120.04218.12
5.5.320.0240.04518.08
5.5.310.0190.03017.88
5.5.300.0120.02016.88
5.5.290.0080.04816.88
5.5.280.0120.02818.45
5.5.270.0100.04218.13
5.5.260.0120.05018.09
5.5.250.0120.04118.11
5.5.240.0240.03518.02
5.5.230.0190.00415.88
5.5.220.0080.01515.63
5.5.210.0160.01015.75
5.5.200.0250.00315.69
5.5.190.0120.01215.63
5.5.180.0200.01015.31
5.5.170.0120.00815.58
5.5.160.0040.02015.53
5.5.150.0030.02015.74
5.5.140.0170.00715.54
5.5.130.0070.01415.42
5.5.120.0110.01515.90
5.5.110.0080.01115.50
5.5.100.0060.01515.74
5.5.90.0140.00715.71
5.5.80.0150.00615.89
5.5.70.0190.00415.71
5.5.60.0110.01515.47
5.5.50.0190.00815.59
5.5.40.0150.00515.47
5.5.30.0150.00815.77
5.5.20.0200.00515.70
5.5.10.0140.00915.70
5.5.00.0140.00715.68
5.4.450.0320.03816.30
5.4.440.0420.02816.35
5.4.430.0200.03516.32
5.4.420.0410.03816.15
5.4.410.0370.03116.23
5.4.400.0460.03416.19
5.4.390.0120.03315.99
5.4.380.0250.02815.82
5.4.370.0190.02815.96
5.4.360.0230.02915.82
5.4.350.0140.02915.95
5.4.340.0200.03215.87
5.4.330.0070.00713.13
5.4.320.0090.02512.82
5.4.310.0110.02012.81
5.4.300.0110.02112.82
5.4.290.0200.09412.81
5.4.280.0080.05412.76
5.4.270.0080.04212.75
5.4.260.0100.02912.76
5.4.250.0110.03312.76
5.4.240.0150.04912.75
5.4.230.0150.04212.75
5.4.220.0110.03312.75
5.4.210.0100.02912.75
5.4.200.0080.05012.75
5.4.190.0110.03912.75
5.4.180.0160.05912.75
5.4.170.0110.03412.76
5.4.160.0090.03012.75
5.4.150.0070.03412.75
5.4.140.0100.02412.60
5.4.130.0120.04012.59
5.4.120.0120.02612.57
5.4.110.0080.03612.57
5.4.100.0110.05112.56
5.4.90.0100.03612.57
5.4.80.0040.03312.56
5.4.70.0120.02712.56
5.4.60.0100.02912.56
5.4.50.0070.03612.56
5.4.40.0150.03612.55
5.4.30.0140.04712.56
5.4.20.0100.02212.55
5.4.10.0070.02612.55
5.4.00.0060.02812.30
5.3.290.0090.02712.98
5.3.280.0140.03312.92
5.3.270.0080.04313.02
5.3.260.0080.03712.92
5.3.250.0100.03412.92
5.3.240.0050.03312.93
5.3.230.0110.03412.92
5.3.220.0110.06312.91
5.3.210.0100.02612.90
5.3.200.0120.02312.90
5.3.190.0060.02812.90
5.3.180.0100.02712.90
5.3.170.0100.02212.96
5.3.160.0100.02212.90
5.3.150.0090.02212.90
5.3.140.0080.02212.89
5.3.130.0060.02712.89
5.3.120.0110.02012.89
5.3.110.0070.02912.89
5.3.100.0100.03112.63
5.3.90.0110.03112.62
5.3.80.0100.02312.62
5.3.70.0100.04312.62
5.3.60.0060.03112.61
5.3.50.0110.02812.59
5.3.40.0090.02812.58
5.3.30.0080.02612.56
5.3.20.0060.02612.45
5.3.10.0090.02112.44
5.3.00.0100.02212.43
5.2.170.0040.0339.23
5.2.160.0060.0429.23
5.2.150.0090.0479.23
5.2.140.0050.0639.23
5.2.130.0150.0669.19
5.2.120.0060.0329.19
5.2.110.0080.0319.20
5.2.100.0080.0309.20
5.2.90.0070.0349.20
5.2.80.0060.0389.19
5.2.70.0070.0329.19
5.2.60.0170.0849.14
5.2.50.0120.0569.11
5.2.40.0100.0389.09
5.2.30.0070.0419.06
5.2.20.0080.0279.05
5.2.10.0080.0318.95
5.2.00.0060.0328.82
5.1.60.0060.0468.10
5.1.50.0230.0438.10
5.1.40.0080.0338.08
5.1.30.0080.0378.43
5.1.20.0070.0398.45
5.1.10.0040.0448.18
5.1.00.0120.0528.18
5.0.50.0040.0356.65
5.0.40.0040.0286.52
5.0.30.0030.0466.33
5.0.20.0030.0216.30
5.0.10.0040.0236.27
5.0.00.0060.0306.27
4.4.90.0050.0204.78
4.4.80.0120.0254.75
4.4.70.0030.0194.75
4.4.60.0060.0234.75
4.4.50.0040.0284.77
4.4.40.0090.0364.71
4.4.30.0030.0164.76
4.4.20.0030.0214.84
4.4.10.0060.0244.85
4.4.00.0040.0394.76
4.3.110.0030.0264.67
4.3.100.0050.0234.67
4.3.90.0040.0224.63
4.3.80.0030.0374.59
4.3.70.0030.0224.63
4.3.60.0050.0194.63
4.3.50.0030.0224.63
4.3.40.0030.0354.54
4.3.30.0040.0213.30
4.3.20.0050.0203.28
4.3.10.0040.0183.23
4.3.00.0030.01710.54

preferences:
60.32 ms | 401 KiB | 5 Q