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; } public function Foo($obj){ echo $obj->secret;die; } } $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; $test->foo($testM); // 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.0160.00318.41
8.3.50.0090.00921.09
8.3.40.0140.00018.76
8.3.30.0110.00320.20
8.3.20.0050.00220.16
8.3.10.0080.00021.82
8.3.00.0040.00422.18
8.2.180.0110.01116.63
8.2.170.0100.00722.96
8.2.160.0070.00720.52
8.2.150.0000.00724.18
8.2.140.0040.00424.66
8.2.130.0070.01026.16
8.2.120.0050.00319.41
8.2.110.0090.00022.25
8.2.100.0100.00317.78
8.2.90.0020.00519.10
8.2.80.0040.00419.39
8.2.70.0040.00417.50
8.2.60.0040.00417.90
8.2.50.0070.00318.07
8.2.40.0030.00517.91
8.2.30.0040.00417.83
8.2.20.0070.00017.45
8.2.10.0050.00317.52
8.2.00.0000.00717.61
8.1.280.0000.01425.92
8.1.270.0090.00024.66
8.1.260.0080.00026.35
8.1.250.0050.00328.09
8.1.240.0030.00623.70
8.1.230.0040.00719.05
8.1.220.0060.00317.74
8.1.210.0050.00318.77
8.1.200.0090.00017.11
8.1.190.0000.00817.05
8.1.180.0040.00418.89
8.1.170.0040.00418.45
8.1.160.0040.00422.07
8.1.150.0000.00718.56
8.1.140.0000.00717.38
8.1.130.0000.00817.65
8.1.120.0000.00717.39
8.1.110.0070.00017.21
8.1.100.0040.00317.40
8.1.90.0030.00317.38
8.1.80.0000.00717.35
8.1.70.0000.00817.23
8.1.60.0000.00917.48
8.1.50.0000.00817.38
8.1.40.0000.00717.36
8.1.30.0080.00017.42
8.1.20.0000.00817.49
8.1.10.0030.00517.41
8.1.00.0060.00317.21
8.0.300.0040.00418.77
8.0.290.0070.00016.92
8.0.280.0000.00718.24
8.0.270.0050.00317.05
8.0.260.0040.00416.75
8.0.250.0000.00716.86
8.0.240.0030.00616.87
8.0.230.0030.00316.94
8.0.220.0000.00716.88
8.0.210.0000.00716.66
8.0.200.0000.00716.86
8.0.190.0070.00016.87
8.0.180.0040.00716.74
8.0.170.0050.00316.76
8.0.160.0030.00316.79
8.0.150.0070.00016.80
8.0.140.0000.00816.80
8.0.130.0000.00613.21
8.0.120.0040.00416.73
8.0.110.0030.00516.79
8.0.100.0040.00416.70
8.0.90.0040.00416.74
8.0.80.0110.00416.82
8.0.70.0040.00416.84
8.0.60.0070.00016.64
8.0.50.0070.00016.78
8.0.30.0130.00617.06
8.0.20.0050.01317.40
8.0.10.0040.00416.82
8.0.00.0090.00916.68
7.4.330.0000.00615.00
7.4.320.0040.00416.55
7.4.300.0060.00016.57
7.4.290.0070.00016.65
7.4.280.0030.00316.39
7.4.270.0030.00316.36
7.4.260.0060.00316.63
7.4.250.0050.00316.46
7.4.240.0030.00316.58
7.4.230.0070.00016.56
7.4.220.0070.00816.65
7.4.210.0090.00616.54
7.4.200.0070.00016.36
7.4.190.0030.00516.48
7.4.160.0030.01316.62
7.4.150.0060.01317.40
7.4.140.0090.01117.86
7.4.130.0100.00616.53
7.4.120.0030.01316.54
7.4.110.0070.01016.40
7.4.100.0040.01516.39
7.4.90.0040.01516.44
7.4.80.0090.00919.39
7.4.70.0110.00716.50
7.4.60.0140.00316.65
7.4.50.0030.00616.48
7.4.40.0040.01122.77
7.4.30.0110.00616.24
7.4.00.0070.01115.18
7.3.330.0030.00313.28
7.3.320.0030.00313.30
7.3.310.0040.00416.33
7.3.300.0050.00216.21
7.3.290.0040.01016.31
7.3.280.0050.01016.24
7.3.270.0140.00517.40
7.3.260.0100.00616.32
7.3.250.0110.00716.40
7.3.240.0130.00316.54
7.3.230.0030.02016.55
7.3.210.0120.00616.44
7.3.200.0060.01219.39
7.3.190.0120.00616.35
7.3.180.0070.01316.31
7.3.170.0180.00616.30
7.3.160.0090.00916.24
7.3.120.0070.01014.99
7.3.110.0000.01514.48
7.3.100.0070.00414.41
7.3.90.0090.00614.81
7.3.80.0040.01114.91
7.3.70.0030.01414.93
7.3.60.0130.00014.92
7.3.50.0070.01114.82
7.3.40.0040.01114.88
7.3.30.0030.01114.57
7.3.20.0110.00316.58
7.3.10.0070.00716.40
7.3.00.0100.00716.53
7.2.330.0090.00916.57
7.2.320.0080.00916.57
7.2.310.0070.01016.78
7.2.300.0070.01016.52
7.2.290.0080.00816.74
7.2.240.0030.01214.91
7.2.230.0040.01114.69
7.2.220.0000.01314.95
7.2.210.0030.01315.06
7.2.200.0030.01215.23
7.2.190.0040.01215.06
7.2.180.0030.00715.05
7.2.170.0060.00615.11
7.2.160.0120.00414.85
7.2.150.0120.00316.53
7.2.140.0090.00617.00
7.2.130.0030.00917.01
7.2.120.0030.00916.73
7.2.110.0070.00717.04
7.2.100.0030.00816.97
7.2.90.0100.00317.15
7.2.80.0070.01116.52
7.2.70.0040.01417.01
7.2.60.0030.00916.91
7.2.50.0070.01016.67
7.2.40.0100.00717.07
7.2.30.0050.00516.85
7.2.20.0070.00716.75
7.2.10.0060.00916.96
7.2.00.0070.00718.23
7.1.330.0070.00416.00
7.1.320.0080.00815.63
7.1.310.0070.00715.87
7.1.300.0060.00915.78
7.1.290.0030.01015.64
7.1.280.0100.00315.45
7.1.270.0000.01615.43
7.1.260.0030.01315.79
7.1.250.0070.00415.93
7.1.200.0120.00015.64
7.1.100.0110.00417.96
7.1.70.0040.00417.21
7.1.60.0030.02019.21
7.1.50.0070.01716.96
7.1.00.0030.03322.44
7.0.200.0150.00814.92
7.0.140.0000.07722.12
7.0.60.0070.08719.92
7.0.50.0000.08717.97
7.0.40.0130.08320.21
7.0.30.0200.04020.19
7.0.20.0270.05320.21
7.0.10.0170.07720.23
7.0.00.0070.05020.29
5.6.210.0200.05320.55
5.6.200.0100.08318.29
5.6.190.0100.06020.46
5.6.180.0300.07720.61
5.6.170.0330.04720.62
5.6.160.0070.07720.46
5.6.150.0170.03318.27
5.6.140.0070.08318.17
5.6.130.0030.05318.24
5.6.120.0100.05321.02
5.6.110.0200.06320.99
5.6.100.0100.08021.09
5.6.90.0100.06721.11
5.6.80.0000.04320.41
5.6.70.4300.04320.34
5.5.350.0100.08020.45
5.5.340.0070.04017.98
5.5.330.0100.07720.40
5.5.320.0070.03720.51
5.5.310.0370.07320.28
5.5.300.0130.07017.94
5.5.290.0070.08317.98
5.5.280.0070.05020.98
5.5.270.0000.05720.88
5.5.260.0100.08020.88
5.5.250.0070.07720.80
5.5.240.0230.07720.27
5.4.450.0700.06019.71
5.4.440.0630.05319.19
5.4.430.0730.06019.47
5.4.420.0170.05719.70
5.4.410.0500.04019.50
5.4.400.0500.05718.76
5.4.390.0400.06018.57
5.4.380.0370.06718.89
5.4.370.0070.05718.84
5.4.360.0170.04718.58
5.4.350.0110.03912.03
5.4.340.0100.03612.02
5.4.320.0070.04012.52
5.4.310.0080.03512.51
5.4.300.0060.03612.51
5.4.290.0070.03612.50
5.4.280.0050.03712.40
5.4.270.0050.03612.40
5.4.260.0090.04812.40
5.4.250.0070.05318.77
5.4.240.0100.05018.93
5.4.230.0130.05318.63
5.4.220.0130.06718.89
5.4.210.0130.07018.94
5.4.200.0200.05718.90
5.4.190.0030.06718.72
5.4.180.0270.04018.92
5.4.170.0200.06018.74
5.4.160.0100.05718.64
5.4.150.0170.07018.99
5.4.140.0170.04316.44
5.4.130.0170.04016.64
5.4.120.0100.07016.40
5.4.110.0230.05016.45
5.4.100.0170.04716.46
5.4.90.0100.04716.50
5.4.80.0130.04316.58
5.4.70.0030.07716.45
5.4.60.0130.05016.57
5.4.50.0230.05016.45
5.4.40.0170.06016.43
5.4.30.0130.06316.33
5.4.20.0200.07016.54
5.4.10.0130.05316.47
5.4.00.0130.05015.82
5.3.290.0070.03712.80
5.3.280.0200.06314.59
5.3.270.0070.05714.70
5.3.260.0070.06714.84
5.3.250.0070.07714.64
5.3.240.0170.06714.61
5.3.230.0130.06014.60
5.3.220.0030.05714.41
5.3.210.0130.07014.57
5.3.200.0100.05314.75
5.3.190.0200.06014.80
5.3.180.0200.05314.77
5.3.170.0270.07714.66
5.3.160.0030.08314.57
5.3.150.0130.05314.66
5.3.140.0100.08014.75
5.3.130.0200.06014.65
5.3.120.0170.06014.63
5.3.110.0130.07314.39
5.3.100.0100.05013.90
5.3.90.0030.05714.00
5.3.80.0170.06314.09
5.3.70.0170.05314.05
5.3.60.0100.05314.08
5.3.50.0230.04014.03
5.3.40.0130.06014.13
5.3.30.0070.06313.91
5.3.20.0130.05013.61
5.3.10.0100.06713.74
5.3.00.0070.05313.63
5.2.170.0170.04011.24
5.2.160.0100.05011.31
5.2.150.0200.05011.31
5.2.140.0030.06711.33
5.2.130.0100.04711.07
5.2.120.0070.04311.27
5.2.110.0070.04011.01
5.2.100.0130.05011.20
5.2.90.0130.05011.20
5.2.80.0100.04011.08
5.2.70.0030.06311.05
5.2.60.0070.04011.23
5.2.50.0030.04710.94
5.2.40.0130.04011.09
5.2.30.0130.04710.89
5.2.20.0070.05011.07
5.2.10.0130.04011.05
5.2.00.0100.03310.69
5.1.60.0030.03710.16
5.1.50.0070.04710.25
5.1.40.0030.03710.01
5.1.30.0070.03710.51
5.1.20.0030.03710.45
5.1.10.0070.03310.04
5.1.00.0000.04310.13
5.0.50.0030.0278.71
5.0.40.0000.0308.52
5.0.30.0000.0438.18
5.0.20.0030.0408.12
5.0.10.0000.0478.34
5.0.00.0070.0538.38
4.4.90.0130.0237.74
4.4.80.0030.0337.74
4.4.70.0030.0237.74
4.4.60.0000.0307.74
4.4.50.0000.0307.74
4.4.40.0030.0337.74
4.4.30.0030.0277.74
4.4.20.0070.0207.74
4.4.10.0100.0177.74
4.4.00.0100.0337.74
4.3.110.0070.0207.74
4.3.100.0030.0207.74
4.3.90.0000.0207.74
4.3.80.0070.0277.74
4.3.70.0070.0207.74
4.3.60.0030.0237.74
4.3.50.0000.0277.74
4.3.40.0070.0377.74
4.3.30.0070.0177.74
4.3.20.0000.0237.74
4.3.10.0000.0337.74
4.3.00.0000.0235.87

preferences:
56.75 ms | 401 KiB | 5 Q