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; } } class TestM extends Test { public function foo(&$obj){ echo $obj->secret;die; $obj->secret = "HELLO WORLD"; } } $test = new Test; // start editing here $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.60.0120.00318.31
8.3.50.0130.00721.08
8.3.40.0040.01118.93
8.3.30.0070.00720.39
8.3.20.0040.00420.13
8.3.10.0000.00822.00
8.3.00.0080.00022.43
8.2.180.0120.00318.34
8.2.170.0070.01022.96
8.2.160.0140.00020.39
8.2.150.0000.00824.18
8.2.140.0080.00024.66
8.2.130.0110.00726.16
8.2.120.0050.00219.54
8.2.110.0030.00619.30
8.2.100.0080.00417.84
8.2.90.0000.00819.27
8.2.80.0040.00417.97
8.2.70.0060.00317.63
8.2.60.0070.00417.68
8.2.50.0030.00618.07
8.2.40.0040.00418.09
8.2.30.0000.00718.08
8.2.20.0040.00417.58
8.2.10.0030.00517.60
8.2.00.0000.00817.69
8.1.280.0080.00625.92
8.1.270.0070.00024.66
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0090.00023.92
8.1.230.0040.00717.70
8.1.220.0030.00617.74
8.1.210.0060.00318.77
8.1.200.0050.00517.23
8.1.190.0080.00017.23
8.1.180.0040.00418.10
8.1.170.0030.00620.37
8.1.160.0000.00722.06
8.1.150.0000.00918.60
8.1.140.0050.00217.41
8.1.130.0070.00317.84
8.1.120.0040.00417.44
8.1.110.0000.00817.41
8.1.100.0050.00317.45
8.1.90.0030.00417.47
8.1.80.0040.00417.35
8.1.70.0000.00817.33
8.1.60.0060.00317.49
8.1.50.0000.00717.56
8.1.40.0040.00417.58
8.1.30.0000.00817.64
8.1.20.0050.00217.64
8.1.10.0080.00017.63
8.1.00.0040.00817.50
8.0.300.0000.00818.77
8.0.290.0000.00716.75
8.0.280.0000.00718.46
8.0.270.0000.00717.12
8.0.260.0000.00716.80
8.0.250.0000.00716.91
8.0.240.0100.00016.99
8.0.230.0000.00716.94
8.0.220.0000.00716.95
8.0.210.0000.00716.96
8.0.200.0030.00317.04
8.0.190.0000.00716.86
8.0.180.0080.00016.96
8.0.170.0000.00816.90
8.0.160.0000.00717.02
8.0.150.0000.00716.76
8.0.140.0080.00016.88
8.0.130.0000.00613.36
8.0.120.0080.00016.73
8.0.110.0040.00416.81
8.0.100.0060.00316.78
8.0.90.0050.00216.90
8.0.80.0150.00016.87
8.0.70.0040.00416.90
8.0.60.0040.00416.81
8.0.50.0000.00716.97
8.0.30.0090.01017.23
8.0.20.0080.01117.40
8.0.10.0040.00416.93
8.0.00.0100.00816.86
7.4.330.0050.00015.00
7.4.320.0030.00316.45
7.4.300.0050.00316.51
7.4.290.0000.00716.51
7.4.280.0030.00316.54
7.4.270.0070.00016.67
7.4.260.0060.00316.40
7.4.250.0030.00316.59
7.4.240.0020.00616.57
7.4.230.0070.00016.45
7.4.220.0090.01216.70
7.4.210.0060.01016.60
7.4.200.0030.00516.41
7.4.190.0030.00316.66
7.4.160.0100.00716.53
7.4.150.0070.01117.40
7.4.140.0180.00417.86
7.4.130.0140.00316.65
7.4.120.0070.01016.61
7.4.110.0130.00416.54
7.4.100.0100.01316.40
7.4.90.0090.00916.44
7.4.80.0040.01519.39
7.4.70.0060.01316.73
7.4.60.0070.01016.46
7.4.50.0040.00016.50
7.4.40.0000.01922.77
7.4.30.0060.01016.75
7.4.00.0030.01014.82
7.3.330.0030.00313.35
7.3.320.0020.00213.43
7.3.310.0030.00516.24
7.3.300.0030.00316.33
7.3.290.0040.01116.32
7.3.280.0080.00916.34
7.3.270.0080.00817.40
7.3.260.0110.01116.39
7.3.250.0110.01116.35
7.3.240.0070.01016.30
7.3.230.0070.01016.39
7.3.210.0130.00316.30
7.3.200.0100.00619.39
7.3.190.0090.00916.63
7.3.180.0130.00716.32
7.3.170.0090.01316.35
7.3.160.0150.00016.29
7.3.120.0110.00414.68
7.2.330.0110.00616.72
7.2.320.0080.00816.45
7.2.310.0070.01916.54
7.2.300.0130.00316.76
7.2.290.0130.00316.37
7.2.60.0090.00617.03
7.2.00.0030.00919.47
7.1.200.0100.00415.89
7.1.70.0040.00417.11
7.1.60.0030.00817.13
7.1.50.0190.01334.95
7.1.00.0070.06022.51
7.0.200.0000.01116.63
7.0.140.0030.07322.09
7.0.120.0000.06321.95
7.0.110.0070.07321.98
7.0.100.0000.07722.04
7.0.90.0030.07322.28
7.0.80.0030.07322.11
7.0.70.0070.07022.05
7.0.60.0100.06722.08
7.0.50.0000.07722.08
7.0.40.0030.07322.18
7.0.30.0000.06722.02
7.0.20.0000.07021.97
7.0.10.0030.06322.13
7.0.00.0070.06022.10
5.6.280.0070.07020.91
5.6.260.0100.06720.97
5.6.250.0030.07320.87
5.6.240.0030.06720.77
5.6.230.0000.08021.02
5.6.220.0000.07720.92
5.6.210.0070.07020.96
5.6.200.0170.05720.81
5.6.190.0070.06021.06
5.6.180.0070.06720.77
5.6.170.0000.07320.95
5.6.160.0070.06320.95
5.6.150.0070.07321.05
5.6.140.0100.07020.80
5.6.130.0000.07720.83
5.6.120.0030.07321.04
5.6.110.0030.07720.93
5.6.100.0130.06721.02
5.6.90.0030.07320.79
5.6.80.0000.06020.32
5.6.70.0000.06320.23
5.6.60.0000.07320.18
5.6.50.0030.06720.42
5.6.40.0000.07320.21
5.6.30.0100.06320.31
5.6.20.0170.06020.37
5.6.10.0030.07020.16
5.6.00.0030.06720.35
5.5.380.0070.06317.55
5.5.370.0000.06317.64
5.5.360.0030.07317.56
5.5.350.0030.06317.52
5.5.340.0030.07318.05
5.5.330.0030.06317.93
5.5.320.0000.07318.09
5.5.310.0000.06718.10
5.5.300.0030.06318.09
5.5.290.0030.07317.83
5.5.280.0000.07717.91
5.5.270.0030.06718.09
5.5.260.0070.07017.82
5.5.250.0030.07017.88
5.5.240.0030.07017.22
5.5.230.0070.06717.61
5.5.220.0070.06317.30
5.5.210.0070.06717.46
5.5.200.0070.06317.47
5.5.190.0030.07017.28
5.5.180.0000.06717.58
5.5.160.0030.06717.18
5.5.150.0030.07017.25
5.5.140.0030.06317.47
5.5.130.0070.04717.27
5.5.120.0030.06717.31
5.5.110.0000.06317.44
5.5.100.0030.06317.48
5.5.90.0030.06317.21
5.5.80.0070.06317.29
5.5.70.0000.06317.14
5.5.60.0000.07017.31
5.5.50.0030.06717.38
5.5.40.0000.06717.46
5.5.30.0000.07017.30
5.5.20.0030.07017.15
5.5.10.0000.07017.16
5.5.00.0030.06717.45
5.4.450.0000.06319.41
5.4.440.0070.06719.37
5.4.430.0030.07019.47
5.4.420.0000.07319.30
5.4.410.0070.06019.33
5.4.400.0070.06318.98
5.4.390.0030.07019.33
5.4.380.0000.06318.94
5.4.370.0030.06719.33
5.4.360.0030.06019.23
5.4.350.0000.07019.02
5.4.340.0030.07019.01
5.4.320.0070.07019.14
5.4.310.0030.06019.24
5.4.300.0070.06019.23
5.4.290.0030.06319.00
5.4.280.0030.07019.00
5.4.270.0030.06319.21
5.4.260.0000.07019.30
5.4.250.0000.07019.32
5.4.240.0000.07019.16
5.4.230.0070.06319.23
5.4.220.0030.07019.23
5.4.210.0030.06718.99
5.4.200.0030.06319.07
5.4.190.0000.06318.93
5.4.180.0030.06718.96
5.4.170.0030.06719.16
5.4.160.0030.06719.14
5.4.150.0070.06319.28
5.4.140.0100.06016.43
5.4.130.0030.06316.43
5.4.120.0030.05316.58
5.4.110.0000.07016.67
5.4.100.0000.06716.59
5.4.90.0000.06016.62
5.4.80.0000.06316.50
5.4.70.0030.06316.44
5.4.60.0070.05316.44
5.4.50.0000.06716.39
5.4.40.0000.06716.53
5.4.30.0070.05016.50
5.4.20.0000.06016.43
5.4.10.0100.06016.53
5.4.00.0030.05716.06
5.3.290.0030.06714.70
5.3.280.0030.06714.84
5.3.270.0000.07014.63
5.3.260.0070.07014.47
5.3.250.0000.07014.84
5.3.240.0000.07014.73
5.3.230.0070.06014.58
5.3.220.0000.06014.70
5.3.210.0030.06014.58
5.3.200.0000.07014.80
5.3.190.0070.06314.71
5.3.180.0070.06014.54
5.3.170.0000.07014.55
5.3.160.0030.06714.80
5.3.150.0000.06714.70
5.3.140.0070.06314.57
5.3.130.0000.07314.55
5.3.120.0100.06314.57
5.3.110.0100.06014.57
5.3.100.0000.06314.27
5.3.90.0000.07014.03
5.3.80.0030.06314.03
5.3.70.0000.06014.12
5.3.60.0000.06714.09
5.3.50.0000.06713.81
5.3.40.0030.06313.96
5.3.30.0030.06314.00
5.3.20.0030.06013.66
5.3.10.0000.06713.65
5.3.00.0000.07013.64
5.2.170.0030.05711.29
5.2.160.0070.05011.18
5.2.150.0070.05311.22
5.2.140.0030.05011.12
5.2.130.0000.05311.19
5.2.120.0000.05311.13
5.2.110.0030.05011.19
5.2.100.0030.05011.12
5.2.90.0030.05311.08
5.2.80.0030.05011.08
5.2.70.0030.05310.96
5.2.60.0030.05311.04
5.2.50.0000.05711.02
5.2.40.0100.04011.01
5.2.30.0000.05710.99
5.2.20.0030.05310.94
5.2.10.0070.04010.88
5.2.00.0000.05710.71
5.1.60.0000.04710.00
5.1.50.0030.0379.97
5.1.40.0030.0479.99
5.1.30.0030.04710.20
5.1.20.0000.05310.44
5.1.10.0000.04310.15
5.1.00.0000.04710.25
5.0.50.0030.0379.77
5.0.40.0000.0379.77
5.0.30.0000.0539.77
5.0.20.0030.0379.77
5.0.10.0000.0409.77
5.0.00.0000.0579.77
4.4.90.0000.0309.77
4.4.80.0000.0309.77
4.4.70.0000.0309.77
4.4.60.0030.0279.77
4.4.50.0030.0239.77
4.4.40.0000.0479.77
4.4.30.0000.0309.77
4.4.20.0000.0339.77
4.4.10.0030.0309.77
4.4.00.0000.0409.77
4.3.110.0030.0309.77
4.3.100.0000.0279.77
4.3.90.0000.0309.77
4.3.80.0000.0439.77
4.3.70.0000.0309.77
4.3.60.0000.0239.77
4.3.50.0000.0309.77
4.3.40.0000.0479.77
4.3.30.0000.0339.77
4.3.20.0000.0339.77
4.3.10.0030.0309.77
4.3.00.0030.0309.77

preferences:
42.98 ms | 401 KiB | 5 Q