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); print_r($test->testy);die(); 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]); $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.0070.00717.00
8.3.50.0070.00718.33
8.3.40.0150.00318.79
8.3.30.0140.00019.18
8.3.20.0080.01220.14
8.3.10.0000.00823.46
8.3.00.0080.00019.38
8.2.180.0160.00318.48
8.2.170.0070.01122.96
8.2.160.0040.01120.27
8.2.150.0000.00924.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0080.00022.27
8.2.110.0100.00022.14
8.2.100.0080.00317.91
8.2.90.0000.00819.09
8.2.80.0090.00018.04
8.2.70.0060.00317.50
8.2.60.0080.00017.93
8.2.50.0130.00018.07
8.2.40.0030.00520.01
8.2.30.0100.00017.97
8.2.20.0060.00317.59
8.2.10.0070.00017.95
8.2.00.0030.00617.68
8.1.270.0060.01322.00
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0030.00623.79
8.1.230.0070.00419.23
8.1.220.0030.00517.74
8.1.210.0040.00418.77
8.1.200.0060.00317.36
8.1.190.0080.00017.51
8.1.180.0030.00518.10
8.1.170.0000.00818.58
8.1.160.0050.00222.01
8.1.150.0030.00818.59
8.1.140.0040.00417.44
8.1.130.0030.00317.89
8.1.120.0050.00217.38
8.1.110.0030.00617.45
8.1.100.0040.00417.41
8.1.90.0050.00317.45
8.1.80.0070.00017.39
8.1.70.0000.00717.42
8.1.60.0040.00417.48
8.1.50.0040.00417.41
8.1.40.0040.00417.45
8.1.30.0030.00617.64
8.1.20.0000.00817.64
8.1.10.0040.00417.54
8.1.00.0040.00417.41
8.0.300.0080.00020.67
8.0.290.0070.00017.05
8.0.280.0000.00718.45
8.0.270.0000.00717.21
8.0.260.0060.00017.20
8.0.250.0000.00717.00
8.0.240.0040.00417.04
8.0.230.0000.00716.90
8.0.220.0070.00016.88
8.0.210.0000.00716.93
8.0.200.0070.00016.96
8.0.190.0040.00416.95
8.0.180.0000.00816.86
8.0.170.0000.00816.95
8.0.160.0040.00416.88
8.0.150.0000.00716.93
8.0.140.0050.00316.91
8.0.130.0060.00013.35
8.0.120.0000.00816.84
8.0.110.0070.00016.87
8.0.100.0080.00016.93
8.0.90.0070.00016.89
8.0.80.0030.01316.89
8.0.70.0040.00416.78
8.0.60.0080.00016.91
8.0.50.0040.00416.73
8.0.30.0120.00817.13
8.0.20.0100.01017.40
8.0.10.0080.00016.98
8.0.00.0110.00616.67
7.4.330.0020.00215.00
7.4.320.0000.00616.50
7.4.300.0060.00016.54
7.4.290.0000.00716.62
7.4.280.0000.00716.58
7.4.270.0070.00016.66
7.4.260.0030.00316.61
7.4.250.0000.00816.46
7.4.240.0020.00616.50
7.4.230.0030.00316.62
7.4.220.0060.01216.48
7.4.210.0070.00816.57
7.4.200.0000.00716.61
7.4.190.0070.00016.70
7.4.160.0140.00316.45
7.4.150.0120.00617.40
7.4.140.0070.00917.86
7.4.130.0060.01216.61
7.4.120.0090.00816.50
7.4.110.0080.01516.50
7.4.100.0140.00716.42
7.4.90.0150.00316.52
7.4.80.0170.00719.39
7.4.70.0130.00316.54
7.4.60.0090.01016.60
7.4.50.0090.00016.50
7.4.40.0030.01022.77
7.4.30.0060.00916.65
7.4.00.0040.01214.78
7.3.330.0070.00013.30
7.3.320.0050.00013.28
7.3.310.0040.00416.45
7.3.300.0000.00816.40
7.3.290.0180.00316.46
7.3.280.0100.00716.43
7.3.270.0070.01017.40
7.3.260.0040.01916.30
7.3.250.0080.01216.51
7.3.240.0100.00716.45
7.3.230.0130.00316.56
7.3.210.0120.00316.47
7.3.200.0110.01519.39
7.3.190.0160.00316.45
7.3.180.0110.00916.66
7.3.170.0130.00316.27
7.3.160.0110.00616.41
7.3.120.0130.00315.00
7.3.110.0090.00615.01
7.3.100.0130.00014.72
7.3.90.0070.00714.55
7.3.80.0060.00614.88
7.3.70.0030.01314.86
7.3.60.0080.00414.73
7.3.50.0100.00314.64
7.3.40.0030.01314.56
7.3.30.0140.00314.88
7.3.20.0030.01016.77
7.3.10.0030.00716.40
7.3.00.0040.01116.40
7.2.330.0100.01016.84
7.2.320.0170.00316.85
7.2.310.0150.00616.78
7.2.300.0100.00716.68
7.2.290.0070.01016.85
7.2.240.0060.01014.76
7.2.230.0030.01014.77
7.2.220.0070.00815.25
7.2.210.0030.01115.00
7.2.200.0100.00315.26
7.2.190.0060.00915.11
7.2.180.0030.01015.25
7.2.170.0110.00714.94
7.2.160.0070.00714.99
7.2.150.0040.01117.02
7.2.140.0030.01216.92
7.2.130.0100.00717.04
7.2.120.0090.00616.91
7.2.110.0080.00416.74
7.2.100.0150.00316.92
7.2.90.0100.00316.69
7.2.80.0040.01116.81
7.2.70.0090.00616.96
7.2.60.0050.01016.70
7.2.50.0030.01216.89
7.2.40.0070.00717.03
7.2.30.0030.01417.13
7.2.20.0040.00816.94
7.2.10.0040.01216.75
7.2.00.0060.00818.12
7.1.330.0070.01015.79
7.1.320.0090.00615.86
7.1.310.0030.01415.73
7.1.300.0090.00615.95
7.1.290.0030.00615.80
7.1.280.0040.01115.93
7.1.270.0030.00615.55
7.1.260.0040.01215.80
7.1.250.0110.00415.84
7.1.200.0030.00715.85
7.1.100.0000.01118.07
7.1.70.0050.00216.88
7.1.60.0000.01619.46
7.1.50.0090.01216.68
7.1.00.0070.07322.57
7.0.200.0000.00716.70
7.0.140.0070.07022.07
7.0.60.0100.04720.02
7.0.50.0100.05017.90
7.0.40.0130.06020.11
7.0.30.0200.04020.15
7.0.20.0230.03320.33
7.0.10.0130.05020.12
7.0.00.0070.08720.14
5.6.280.0030.07321.07
5.6.210.0130.08020.60
5.6.200.0070.08318.20
5.6.190.0000.05020.47
5.6.180.0370.06020.64
5.6.170.0300.05720.54
5.6.160.0030.06320.54
5.6.150.0100.03718.15
5.6.140.0070.07718.18
5.6.130.0100.08018.19
5.6.120.0070.08320.91
5.6.110.0070.07021.10
5.6.100.0030.06321.01
5.6.90.0130.08321.00
5.6.80.0100.07020.41
5.6.70.0430.06020.48
5.5.350.0000.08320.45
5.5.340.0000.09017.95
5.5.330.0070.05720.25
5.5.320.0230.04320.25
5.5.310.0400.05720.37
5.5.300.0200.03718.04
5.5.290.0030.08318.07
5.5.280.0130.06720.87
5.5.270.0100.07720.73
5.5.260.0000.07020.98
5.5.250.0100.07720.69
5.5.240.0070.06320.19
5.4.450.0600.06719.47
5.4.440.0870.05019.61
5.4.430.0900.05719.59
5.4.420.0730.05719.29
5.4.410.0200.06019.20
5.4.400.1200.06019.30
5.4.390.0630.06018.99
5.4.380.0230.05718.75
5.4.370.0330.06718.61
5.4.360.0300.05018.70
5.4.350.0330.06018.75
5.4.340.0300.06718.79
5.4.320.0110.03212.51
5.4.310.0080.03712.50
5.4.300.0070.03912.51
5.4.290.0070.04112.49
5.4.280.0230.06512.39
5.4.270.0100.04912.39
5.4.260.0050.05112.39
5.4.250.0090.05312.38
5.4.240.0110.05012.38
5.4.230.0190.06412.38
5.4.220.0140.05012.38
5.4.210.0130.03512.38
5.4.200.0080.04612.37
5.4.190.0140.04012.37
5.4.180.0120.05512.37
5.4.170.0100.05412.38
5.4.160.0070.03812.38
5.4.150.0090.04812.38
5.4.140.0090.04912.06
5.4.130.0110.04612.04
5.4.120.0080.03712.01
5.4.110.0090.03412.00
5.4.100.0070.04012.00
5.4.90.0070.03612.00
5.4.80.0080.04412.00
5.4.70.0080.03512.00
5.4.60.0060.04412.00
5.4.50.0130.03712.00
5.4.40.0070.03811.98
5.4.30.0130.04311.98
5.4.20.0090.06011.98
5.4.10.0100.04911.98
5.4.00.0040.06611.47
5.3.290.0080.05312.80
5.3.280.0080.06912.71
5.3.270.0110.05912.73
5.3.260.0130.06812.72
5.3.250.0110.05412.72
5.3.240.0150.05612.72
5.3.230.0120.05812.71
5.3.220.0060.04512.68
5.3.210.0100.06512.68
5.3.200.0120.04112.68
5.3.190.0110.03612.68
5.3.180.0090.03712.67
5.3.170.0100.03712.67
5.3.160.0060.04712.67
5.3.150.0090.05212.68
5.3.140.0110.04812.66
5.3.130.0140.05612.66
5.3.120.0110.03812.66
5.3.110.0040.04512.66
5.3.100.0060.04712.13
5.3.90.0080.03912.11
5.3.80.0080.03912.10
5.3.70.0090.03812.11
5.3.60.0080.03812.09
5.3.50.0060.03912.04
5.3.40.0060.04412.04
5.3.30.0100.05711.99
5.3.20.0060.04211.77
5.3.10.0130.04311.74
5.3.00.0140.04811.73
5.2.170.0070.0449.23
5.2.160.0110.0509.23
5.2.150.0070.0349.23
5.2.140.0030.0349.23
5.2.130.0090.0279.19
5.2.120.0040.0309.19
5.2.110.0040.0309.20
5.2.100.0060.0289.19
5.2.90.0040.0319.20
5.2.80.0080.0349.19
5.2.70.0050.0319.19
5.2.60.0070.0319.14
5.2.50.0060.0379.11
5.2.40.0110.0459.09
5.2.30.0100.0449.06
5.2.20.0030.0369.05
5.2.10.0090.0398.96
5.2.00.0090.0368.82
5.1.60.0060.0338.10
5.1.50.0050.0368.10
5.1.40.0070.0408.08
5.1.30.0070.0398.43
5.1.20.0080.0488.45
5.1.10.0070.0348.18
5.1.00.0070.0278.18
5.0.50.0040.0276.66
5.0.40.0060.0196.52
5.0.30.0050.0386.33
5.0.20.0040.0226.30
5.0.10.0030.0236.28
5.0.00.0040.0356.27
4.4.90.0010.0204.78
4.4.80.0040.0164.75
4.4.70.0060.0214.75
4.4.60.0020.0244.75
4.4.50.0090.0244.77
4.4.40.0090.0324.71
4.4.30.0050.0224.76
4.4.20.0060.0224.84
4.4.10.0050.0224.84
4.4.00.0060.0374.76
4.3.110.0030.0204.67
4.3.100.0060.0164.66
4.3.90.0070.0154.64
4.3.80.0030.0284.59
4.3.70.0040.0164.63
4.3.60.0050.0154.62
4.3.50.0020.0184.63
4.3.40.0060.0284.54
4.3.30.0010.0193.30
4.3.20.0020.0193.28
4.3.10.0040.0293.24
4.3.00.0030.02710.54

preferences:
57.8 ms | 400 KiB | 5 Q