3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* Challenge 1: Modify 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 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 TestM extends Test { private $secret; public function foo(Test $obj){ echo $obj->secret;die; $obj->secret = "HELLO WORLD"; } } $testM = new TestM; $testM->foo($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.00616.88
8.3.60.0040.01518.41
8.3.50.0180.00321.08
8.3.40.0070.01018.87
8.3.30.0070.00720.39
8.3.20.0020.00520.01
8.3.10.0030.00522.13
8.3.00.0040.00422.34
8.2.180.0060.00916.50
8.2.170.0110.00722.96
8.2.160.0030.01020.35
8.2.150.0030.00524.18
8.2.140.0000.00824.66
8.2.130.0060.01226.16
8.2.120.0050.00319.64
8.2.110.0030.00622.14
8.2.100.0090.00317.53
8.2.90.0000.00719.22
8.2.80.0000.00719.39
8.2.70.0030.00617.50
8.2.60.0040.00417.91
8.2.50.0060.00318.07
8.2.40.0050.00317.96
8.2.30.0020.00517.88
8.2.20.0040.00417.63
8.2.10.0000.00817.57
8.2.00.0040.00417.73
8.1.280.0170.00325.92
8.1.270.0060.00324.66
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0040.00423.96
8.1.230.0070.00319.04
8.1.220.0030.00617.74
8.1.210.0000.00818.77
8.1.200.0040.00417.23
8.1.190.0040.00417.54
8.1.180.0030.00519.01
8.1.170.0030.00618.45
8.1.160.0000.00722.18
8.1.150.0000.00718.53
8.1.140.0000.00717.35
8.1.130.0030.00717.75
8.1.120.0000.00717.26
8.1.110.0070.00017.43
8.1.100.0070.00017.38
8.1.90.0040.00417.30
8.1.80.0000.00717.34
8.1.70.0000.00817.29
8.1.60.0030.00617.55
8.1.50.0040.00417.43
8.1.40.0000.00817.51
8.1.30.0080.00017.61
8.1.20.0060.00317.53
8.1.10.0050.00217.59
8.1.00.0070.00417.42
8.0.300.0050.00218.77
8.0.290.0000.00717.16
8.0.280.0000.00718.40
8.0.270.0000.00717.07
8.0.260.0060.00016.82
8.0.250.0000.00716.86
8.0.240.0090.00016.98
8.0.230.0030.00316.88
8.0.220.0000.00716.96
8.0.210.0000.00716.86
8.0.200.0030.00316.97
8.0.190.0000.00816.88
8.0.180.0030.00716.80
8.0.170.0000.00816.83
8.0.160.0070.00016.83
8.0.150.0050.00216.93
8.0.140.0040.00416.80
8.0.130.0030.00313.34
8.0.120.0020.00516.92
8.0.110.0000.00716.79
8.0.100.0040.00416.88
8.0.90.0040.00416.77
8.0.80.0000.01516.95
8.0.70.0050.00316.84
8.0.60.0070.00016.78
8.0.50.0040.00416.84
8.0.30.0130.00517.12
8.0.20.0090.01117.40
8.0.10.0000.00816.89
8.0.00.0080.00916.84
7.4.330.0020.00215.00
7.4.320.0070.00016.40
7.4.300.0030.00316.53
7.4.290.0000.00716.41
7.4.280.0000.00716.52
7.4.270.0030.00316.55
7.4.260.0000.00716.42
7.4.250.0030.00316.49
7.4.240.0040.00416.58
7.4.230.0040.00416.55
7.4.220.0110.00416.63
7.4.210.0060.00916.53
7.4.200.0040.00416.70
7.4.190.0030.00316.68
7.4.160.0080.00816.39
7.4.150.0090.00917.40
7.4.140.0080.01317.86
7.4.130.0060.01116.54
7.4.120.0080.00916.68
7.4.110.0100.00616.50
7.4.100.0090.00916.60
7.4.90.0140.00316.67
7.4.80.0030.01619.39
7.4.70.0130.00616.63
7.4.60.0130.00316.38
7.4.50.0000.00616.48
7.4.40.0030.01022.77
7.4.30.0120.00416.34
7.4.10.0090.00914.74
7.4.00.0090.00814.84
7.3.330.0030.00313.25
7.3.320.0050.00013.15
7.3.310.0000.00816.39
7.3.300.0030.00316.43
7.3.290.0040.01016.44
7.3.280.0070.00916.41
7.3.270.0090.00917.40
7.3.260.0090.00616.28
7.3.250.0100.00816.47
7.3.240.0070.01016.52
7.3.230.0070.01016.57
7.3.210.0100.00716.35
7.3.200.0070.01019.39
7.3.190.0130.00616.58
7.3.180.0070.00716.30
7.3.170.0070.01016.45
7.3.160.0130.00416.63
7.3.130.0070.01014.74
7.3.120.0040.01314.73
7.3.110.0070.01114.89
7.3.100.0070.00415.07
7.3.90.0000.01614.68
7.3.80.0000.00914.67
7.3.70.0040.00714.64
7.3.60.0030.01414.86
7.3.50.0060.00614.56
7.3.40.0040.01114.83
7.3.30.0060.00914.74
7.3.20.0000.01216.70
7.3.10.0090.00316.77
7.3.00.0080.00516.61
7.2.330.0090.00916.50
7.2.320.0110.01116.62
7.2.310.0090.01416.69
7.2.300.0080.01516.70
7.2.290.0070.01016.58
7.2.260.0030.01014.94
7.2.250.0130.00314.79
7.2.240.0090.00615.18
7.2.230.0070.00715.07
7.2.220.0090.00614.91
7.2.210.0000.01315.09
7.2.200.0040.00815.17
7.2.190.0090.00615.13
7.2.180.0070.00315.11
7.2.170.0060.00615.08
7.2.160.0080.00414.78
7.2.150.0000.01516.70
7.2.140.0100.00016.91
7.2.130.0030.01016.76
7.2.120.0090.00616.98
7.2.110.0000.01416.83
7.2.100.0030.00616.83
7.2.90.0100.00316.59
7.2.80.0090.00616.83
7.2.70.0160.00016.82
7.2.60.0100.00716.95
7.2.50.0090.00516.89
7.2.40.0040.01417.00
7.2.30.0040.01116.90
7.2.20.0030.00916.97
7.2.10.0030.00616.85
7.2.00.0020.01218.10
7.1.330.0120.00315.57
7.1.320.0080.00015.69
7.1.310.0030.01415.61
7.1.300.0030.00515.79
7.1.290.0100.00315.80
7.1.280.0100.00715.64
7.1.270.0000.00815.74
7.1.260.0030.01015.70
7.1.250.0070.01015.63
7.1.240.0090.00315.51
7.1.230.0040.00815.81
7.1.220.0030.00915.38
7.1.210.0130.00315.51
7.1.200.0050.00615.79
7.1.190.0060.00915.73
7.1.180.0060.00315.86
7.1.170.0070.01115.80
7.1.160.0060.00315.70
7.1.150.0060.01015.74
7.1.140.0040.00815.65
7.1.130.0030.00915.68
7.1.120.0070.00715.39
7.1.110.0100.00715.77
7.1.100.0050.00616.89
7.1.90.0040.01115.87
7.1.80.0030.01015.49
7.1.70.0050.00716.51
7.1.60.0080.00817.55
7.1.50.0070.00816.34
7.1.40.0080.00315.82
7.1.30.0110.00015.69
7.1.20.0000.01315.55
7.1.10.0000.01715.63
7.1.00.0060.04319.19
7.0.330.0030.00515.47
7.0.320.0100.00315.22
7.0.310.0140.00015.27
7.0.300.0000.01415.63
7.0.290.0030.00915.14
7.0.280.0070.00715.18
7.0.270.0060.00315.63
7.0.260.0000.01615.23
7.0.250.0070.00715.23
7.0.240.0090.00315.35
7.0.230.0000.01315.53
7.0.220.0060.00615.48
7.0.210.0040.00815.28
7.0.200.0100.00615.24
7.0.190.0040.00715.52
7.0.180.0040.01115.27
7.0.170.0050.00515.39
7.0.160.0070.00715.27
7.0.150.0030.01215.33
7.0.140.0080.03818.86
7.0.130.0060.00615.21
7.0.120.0070.00315.59
7.0.110.0080.00415.21
7.0.100.0040.01115.30
7.0.90.0070.00415.42
7.0.80.0070.00715.35
7.0.70.0060.00315.41
7.0.60.0030.04717.73
7.0.50.0060.02616.63
7.0.40.0140.04016.89
7.0.30.0120.04616.62
7.0.20.0170.04216.68
7.0.10.0090.04516.83
7.0.00.0090.02916.66
5.6.400.0030.00714.04
5.6.390.0100.00314.29
5.6.380.0090.00614.14
5.6.370.0030.01014.39
5.6.360.0000.01714.31
5.6.350.0040.01113.99
5.6.340.0060.01214.14
5.6.330.0040.00414.51
5.6.320.0070.01014.56
5.6.310.0030.00914.36
5.6.300.0060.00314.46
5.6.290.0000.01014.15
5.6.280.0070.03717.69
5.6.270.0000.01114.22
5.6.260.0100.00314.05
5.6.250.0140.00014.30
5.6.240.0070.01014.53
5.6.230.0100.00714.60
5.6.220.0100.00614.13
5.6.210.0080.04217.44
5.6.200.0100.04016.15
5.6.190.0030.03617.35
5.6.180.0180.03517.52
5.6.170.0210.03617.27
5.6.160.0070.04017.39
5.6.150.0070.02416.43
5.6.140.0070.02916.32
5.6.130.0080.01816.18
5.6.120.0030.02417.64
5.6.110.0090.04417.72
5.6.100.0030.04617.76
5.6.90.0080.03617.68
5.6.80.0070.04317.30
5.6.70.1600.02517.33
5.6.60.0030.01414.22
5.6.50.0030.01414.39
5.6.40.0090.00914.02
5.6.30.0140.00014.17
5.6.20.0040.00714.18
5.6.10.0060.00914.38
5.6.00.0100.00014.18
5.5.380.0070.01014.25
5.5.370.0150.00014.23
5.5.360.0030.00914.09
5.5.350.0130.02517.29
5.5.340.0100.04115.98
5.5.330.0050.02717.47
5.5.320.0090.02717.17
5.5.310.0120.04717.32
5.5.300.0090.04016.01
5.5.290.0040.02616.01
5.5.280.0030.02717.73
5.5.270.0080.03817.47
5.5.260.0100.04517.43
5.5.250.0100.04417.37
5.5.240.0080.03317.22
5.5.230.0100.00714.32
5.5.220.0030.01314.33
5.5.210.0070.00414.05
5.5.200.0000.01314.17
5.5.190.0000.00813.79
5.5.180.0030.00713.93
5.5.170.0120.00414.02
5.5.160.0130.00314.27
5.5.150.0080.00414.12
5.5.140.0070.00713.96
5.5.130.0070.00713.96
5.5.120.0120.00014.13
5.5.110.0110.00314.05
5.5.100.0000.01113.97
5.5.90.0030.01014.07
5.5.80.0000.01214.23
5.5.70.0110.00413.79
5.5.60.0040.01114.06
5.5.50.0030.00714.24
5.5.40.0000.01214.48
5.5.30.0040.01114.27
5.5.20.0030.01014.19
5.5.10.0030.00713.99
5.5.00.0030.01414.16
5.4.450.0200.03415.30
5.4.440.0530.03015.23
5.4.430.0320.03715.22
5.4.420.0400.03315.21
5.4.410.0440.03315.15
5.4.400.0250.02914.77
5.4.390.0230.04214.83
5.4.380.0180.02714.90
5.4.370.0080.02814.73
5.4.360.0100.02814.64
5.4.350.0060.02311.61
5.4.340.0050.02511.50
5.4.330.0070.00410.88
5.4.320.0050.02111.65
5.4.310.0080.02611.57
5.4.300.0070.01911.69
5.4.290.0070.02411.84
5.4.280.0030.02311.63
5.4.270.0050.02311.69
5.4.260.0050.02011.71
5.4.250.0080.03214.95
5.4.240.0100.03314.68
5.4.230.0070.03214.81
5.4.220.0070.03714.66
5.4.210.0110.03014.98
5.4.200.0050.03614.93
5.4.190.0100.03714.98
5.4.180.0100.02714.82
5.4.170.0100.03815.05
5.4.160.0110.02514.79
5.4.150.0100.02815.03
5.4.140.0060.03813.61
5.4.130.0050.04313.73
5.4.120.0130.03513.72
5.4.110.0070.02913.51
5.4.100.0100.03213.56
5.4.90.0100.02913.69
5.4.80.0030.03813.82
5.4.70.0020.03013.69
5.4.60.0060.03813.72
5.4.50.0100.03713.60
5.4.40.0030.03113.59
5.4.30.0100.02713.70
5.4.20.0080.03213.56
5.4.10.0070.02613.79
5.4.00.0030.02913.35
5.3.290.0050.02911.66
5.3.280.0030.04012.55
5.3.270.0050.03112.60
5.3.260.0110.03812.57
5.3.250.0100.03312.60
5.3.240.0080.02612.43
5.3.230.0030.03812.43
5.3.220.0060.03512.46
5.3.210.0050.03112.60
5.3.200.0070.03512.60
5.3.190.0080.03612.69
5.3.180.0070.03512.80
5.3.170.0060.03312.58
5.3.160.0130.03512.68
5.3.150.0030.03212.70
5.3.140.0010.03112.49
5.3.130.0100.03712.60
5.3.120.0060.03812.38
5.3.110.0050.03212.67
5.3.100.0080.03212.36
5.3.90.0070.02612.48
5.3.80.0050.02712.26
5.3.70.0050.02912.29
5.3.60.0040.03612.34
5.3.50.0100.03212.14
5.3.40.0100.03412.30
5.3.30.0070.03512.34
5.3.20.0080.02812.06
5.3.10.0070.03212.07
5.3.00.0080.02612.06
5.2.170.0130.04011.23
5.2.160.0130.05011.24
5.2.150.0100.04711.10
5.2.140.0000.06011.13
5.2.130.0000.05711.11
5.2.120.0130.04011.09
5.2.110.0030.05711.33
5.2.100.0100.04011.09
5.2.90.0070.04711.18
5.2.80.0070.04710.93
5.2.70.0100.04011.18
5.2.60.0100.04710.96
5.2.50.0070.04311.02
5.2.40.0170.04711.00
5.2.30.0130.04710.95
5.2.20.0030.06010.86
5.2.10.0030.04711.02
5.2.00.0070.05310.90
5.1.60.0070.0479.95
5.1.50.0100.04010.04
5.1.40.0100.04010.08
5.1.30.0130.04310.33
5.1.20.0170.04710.36
5.1.10.0170.02710.22
5.1.00.0030.04310.16
5.0.50.0070.0308.62
5.0.40.0130.0178.48
5.0.30.0000.0638.24
5.0.20.0100.0278.29
5.0.10.0070.0338.25
5.0.00.0100.0378.01
4.4.90.0030.0307.73
4.4.80.0030.0307.73
4.4.70.0030.0237.73
4.4.60.0030.0237.73
4.4.50.0030.0207.73
4.4.40.0030.0437.73
4.4.30.0100.0177.73
4.4.20.0070.0207.73
4.4.10.0030.0237.73
4.4.00.0030.0477.73
4.3.110.0030.0307.73
4.3.100.0030.0277.73
4.3.90.0030.0237.73
4.3.80.0030.0337.73
4.3.70.0030.0177.73
4.3.60.0000.0237.73
4.3.50.0000.0237.73
4.3.40.0100.0437.73
4.3.30.0100.0137.73
4.3.20.0000.0237.73
4.3.10.0070.0237.73
4.3.00.0130.0235.87

preferences:
60.52 ms | 401 KiB | 5 Q