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; 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 Solution extends ArrayObject { public function __construct($test){ $this->test = $test; } public function offsetGet($index) { return 'callback'; } public function __invoke(){ $func = function(){ $this->secret = "ALL YOUR BASE ARE BELONG TO US 2"; }; return $func->bindTo($this->test, 'Test'); } } $v = new Solution($test); $test->callback = $v; // 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.0200.00318.55
8.3.60.0180.00016.62
8.3.50.0100.00822.17
8.3.40.0120.00618.76
8.3.30.0070.00719.27
8.3.20.0040.00420.39
8.3.10.0050.00223.69
8.3.00.0030.00519.38
8.2.180.0040.01118.29
8.2.170.0070.00722.96
8.2.160.0030.01020.39
8.2.150.0000.00824.18
8.2.140.0000.00724.66
8.2.130.0100.00726.16
8.2.120.0040.00422.29
8.2.110.0110.00020.47
8.2.100.0000.01117.85
8.2.90.0000.00818.34
8.2.80.0030.00619.11
8.2.70.0040.00417.50
8.2.60.0040.00418.03
8.2.50.0000.00818.07
8.2.40.0030.00619.93
8.2.30.0030.00618.02
8.2.20.0040.00417.87
8.2.10.0080.00018.21
8.2.00.0030.00717.77
8.1.280.0110.00725.92
8.1.270.0080.00024.66
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0050.00522.19
8.1.230.0060.00620.77
8.1.220.0060.00317.79
8.1.210.0060.00318.77
8.1.200.0060.00317.35
8.1.190.0080.00017.38
8.1.180.0030.00618.10
8.1.170.0040.00418.48
8.1.160.0050.00322.04
8.1.150.0060.00318.66
8.1.140.0000.00717.58
8.1.130.0030.00317.86
8.1.120.0040.00317.50
8.1.110.0070.00317.48
8.1.100.0000.00717.39
8.1.90.0040.00417.48
8.1.80.0000.00817.47
8.1.70.0050.00217.44
8.1.60.0080.00017.59
8.1.50.0000.00817.59
8.1.40.0030.00617.42
8.1.30.0080.00017.65
8.1.20.0060.00317.68
8.1.10.0040.00417.63
8.1.00.0050.00317.42
8.0.300.0070.00020.09
8.0.290.0060.00317.30
8.0.280.0000.00718.43
8.0.270.0030.00317.22
8.0.260.0040.00417.25
8.0.250.0080.00016.98
8.0.240.0000.00817.00
8.0.230.0050.00316.98
8.0.220.0070.00016.98
8.0.210.0000.00716.82
8.0.200.0040.00416.89
8.0.190.0040.00416.87
8.0.180.0000.00816.89
8.0.170.0000.00716.91
8.0.160.0030.00516.87
8.0.150.0000.00816.90
8.0.140.0070.00016.90
8.0.130.0000.00613.44
8.0.120.0050.00216.89
8.0.110.0050.00316.89
8.0.100.0040.00417.00
8.0.90.0040.00416.77
8.0.80.0130.00316.93
8.0.70.0070.00016.77
8.0.60.0050.00316.81
8.0.50.0070.00016.79
8.0.30.0100.00817.10
8.0.20.0080.01217.40
8.0.10.0000.00717.01
8.0.00.0070.01016.69
7.4.330.0030.00315.00
7.4.320.0040.00416.52
7.4.300.0030.00316.63
7.4.290.0000.00616.52
7.4.280.0000.00716.52
7.4.270.0000.00716.57
7.4.260.0040.00216.51
7.4.250.0050.00316.50
7.4.240.0040.00416.59
7.4.230.0000.00716.52
7.4.220.0060.01216.56
7.4.210.0080.00816.46
7.4.200.0000.00716.53
7.4.190.0000.00716.52
7.4.160.0090.01216.45
7.4.150.0100.00717.40
7.4.140.0100.00917.86
7.4.130.0100.00816.54
7.4.120.0090.00716.60
7.4.110.0090.01616.45
7.4.100.0060.01616.47
7.4.90.0090.00916.68
7.4.80.0040.01419.39
7.4.70.0130.00316.62
7.4.60.0110.00816.57
7.4.50.0040.00416.49
7.4.40.0090.00622.77
7.4.30.0100.00616.77
7.4.10.0130.00314.89
7.4.00.0050.01115.06
7.3.330.0060.00013.34
7.3.320.0020.00213.25
7.3.310.0000.00716.27
7.3.300.0080.00016.39
7.3.290.0070.01616.39
7.3.280.0120.00416.37
7.3.270.0150.00617.40
7.3.260.0200.00316.64
7.3.250.0130.00716.51
7.3.240.0110.00616.39
7.3.230.0140.00316.63
7.3.210.0100.00716.46
7.3.200.0120.00316.49
7.3.190.0110.01116.23
7.3.180.0090.00616.70
7.3.170.0040.01116.63
7.3.160.0030.01216.54
7.3.130.0060.01214.91
7.3.120.0040.00914.78
7.3.110.0100.01014.82
7.3.100.0100.00614.59
7.3.90.0060.00614.99
7.3.80.0070.00714.74
7.3.70.0040.01214.89
7.3.60.0110.00314.94
7.3.50.0040.01115.00
7.3.40.0030.01314.80
7.3.30.0040.01114.70
7.3.20.0030.01016.91
7.3.10.0060.00716.53
7.3.00.0050.01016.65
7.2.330.0030.01316.53
7.2.320.0070.01016.59
7.2.310.0120.00916.64
7.2.300.0060.01016.47
7.2.290.0070.01016.46
7.2.260.0030.01715.14
7.2.250.0030.00715.13
7.2.240.0100.00315.23
7.2.230.0090.00915.07
7.2.220.0110.01115.15
7.2.210.0040.01214.98
7.2.200.0120.00315.23
7.2.190.0040.01115.09
7.2.180.0000.01414.96
7.2.170.0100.00315.22
7.2.160.0130.00314.98
7.2.150.0100.00616.73
7.2.140.0110.00417.02
7.2.130.0090.00516.79
7.2.120.0030.01216.86
7.2.110.0070.00716.80
7.2.100.0070.00916.85
7.2.90.0090.00617.02
7.2.80.0080.00516.97
7.2.70.0020.01116.78
7.2.60.0100.00616.95
7.2.50.0120.00316.85
7.2.40.0090.00516.86
7.2.30.0020.01316.88
7.2.20.0090.00416.75
7.2.10.0050.01016.83
7.2.00.0030.00917.00
7.1.330.0040.00815.63
7.1.320.0000.01516.08
7.1.310.0030.01015.78
7.1.300.0030.01015.75
7.1.290.0070.00715.93
7.1.280.0150.00016.00
7.1.270.0000.01215.85
7.1.260.0030.01015.85
7.1.250.0050.00615.59
7.1.240.0080.00415.95
7.1.230.0070.00715.91
7.1.220.0100.00715.95
7.1.210.0070.00715.81
7.1.200.0000.01015.80
7.1.190.0030.00715.76
7.1.180.0070.00315.89
7.1.170.0040.00415.98
7.1.160.0110.00615.72
7.1.150.0070.00715.73
7.1.140.0100.00315.89
7.1.130.0060.00915.80
7.1.120.0030.00715.80
7.1.110.0000.00815.89
7.1.100.0060.00815.60
7.1.90.0100.00315.50
7.1.80.0110.00015.63
7.1.70.0040.00416.64
7.1.60.0030.01417.52
7.1.50.0180.00725.30
7.1.40.0030.00915.73
7.1.30.0060.00615.87
7.1.20.0060.00615.60
7.1.10.0070.00815.86
7.1.00.0050.04319.08
7.0.330.0070.00715.30
7.0.320.0040.01115.45
7.0.310.0080.00415.45
7.0.300.0000.00815.34
7.0.290.0030.00615.35
7.0.280.0060.00315.44
7.0.270.0000.00915.21
7.0.260.0050.00315.18
7.0.250.0030.00915.41
7.0.240.0000.01215.56
7.0.230.0060.00615.33
7.0.220.0070.00315.52
7.0.210.0030.01015.32
7.0.200.0050.00816.06
7.0.190.0030.00915.50
7.0.180.0000.00815.58
7.0.170.0070.00415.46
7.0.160.0040.00415.55
7.0.150.0030.00615.24
7.0.140.0080.04018.68
7.0.130.0140.00015.45
7.0.120.0000.01115.13
7.0.110.0070.00415.17
7.0.100.0070.00315.55
7.0.90.0040.00715.54
7.0.80.0050.00515.29
7.0.70.0030.01015.67
7.0.60.0060.04617.66
7.0.50.0090.02016.79
7.0.40.0140.04116.75
7.0.30.0180.04016.81
7.0.20.0130.02616.78
7.0.10.0160.03916.90
7.0.00.0040.02316.71
5.6.400.0040.01114.37
5.6.390.0000.01314.76
5.6.380.0070.00314.04
5.6.370.0070.00714.62
5.6.360.0090.00314.11
5.6.350.0030.01114.26
5.6.340.0030.00614.58
5.6.330.0000.01114.37
5.6.320.0030.01014.30
5.6.310.0030.01014.67
5.6.300.0100.00314.67
5.6.290.0040.01114.59
5.6.280.0080.03617.85
5.6.270.0090.00014.48
5.6.260.0030.01414.53
5.6.250.0000.01414.38
5.6.240.0030.00914.53
5.6.230.0000.01014.66
5.6.220.0040.00814.45
5.6.210.0070.03917.47
5.6.200.0080.02716.41
5.6.190.0080.04817.56
5.6.180.0130.04417.33
5.6.170.0180.03917.58
5.6.160.0070.04517.35
5.6.150.0040.02416.27
5.6.140.0090.03816.36
5.6.130.0120.03816.25
5.6.120.0090.03117.77
5.6.110.0120.04217.62
5.6.100.0060.03117.79
5.6.90.0070.02617.64
5.6.80.0060.03617.25
5.6.70.2070.02217.33
5.6.60.0000.01414.30
5.6.50.0030.00614.32
5.6.40.0030.00914.12
5.6.30.0000.01414.41
5.6.20.0030.00614.43
5.6.10.0060.00914.27
5.6.00.0030.01214.41
5.5.380.0070.00714.48
5.5.370.0050.00514.51
5.5.360.0000.01314.42
5.5.350.0040.03517.41
5.5.340.0050.02016.06
5.5.330.0070.04517.35
5.5.320.0220.03017.22
5.5.310.0150.02017.44
5.5.300.0050.03116.22
5.5.290.0050.04716.32
5.5.280.0020.02617.64
5.5.270.0050.02117.71
5.5.260.0100.04517.60
5.5.250.0060.04517.53
5.5.240.0040.04617.31
5.5.230.0060.00614.38
5.5.220.0060.00314.44
5.5.210.0100.00714.40
5.5.200.0030.01014.32
5.5.190.0090.00014.13
5.5.180.0050.00314.23
5.5.170.0100.00314.28
5.5.160.0080.00414.43
5.5.150.0040.01114.54
5.5.140.0000.01413.98
5.5.130.0070.00314.29
5.5.120.0060.00914.25
5.5.110.0070.00714.44
5.5.100.0000.01414.45
5.5.90.0030.01314.52
5.5.80.0060.00914.08
5.5.70.0030.01014.33
5.5.60.0120.00014.45
5.5.50.0060.00314.51
5.5.40.0070.00314.15
5.5.30.0040.01114.37
5.5.20.0080.00814.64
5.5.10.0000.01113.80
5.5.00.0080.00314.39
5.4.450.0350.03515.37
5.4.440.0570.03315.35
5.4.430.0200.02815.28
5.4.420.0480.02615.22
5.4.410.0430.03315.30
5.4.400.0350.03215.07
5.4.390.0450.03815.22
5.4.380.0180.02814.90
5.4.370.0270.03014.78
5.4.360.0200.03115.06
5.4.350.0230.02615.07
5.4.340.0210.02514.82
5.4.330.0000.00710.95
5.4.320.0030.02511.66
5.4.310.0050.02511.93
5.4.300.0040.02211.89
5.4.290.0060.02411.91
5.4.280.0050.02311.76
5.4.270.0040.02311.86
5.4.260.0050.02211.81
5.4.250.0050.02511.86
5.4.240.0070.01911.67
5.4.230.0040.02111.85
5.4.220.0050.02111.65
5.4.210.0040.01911.86
5.4.200.0050.02111.86
5.4.190.0050.02411.74
5.4.180.0040.02211.68
5.4.170.0040.02611.78
5.4.160.0080.02011.75
5.4.150.0060.02511.81
5.4.140.0060.02211.61
5.4.130.0090.01911.72
5.4.120.0040.02611.62
5.4.110.0090.01911.45
5.4.100.0070.01811.43
5.4.90.0050.02311.58
5.4.80.0040.02511.45
5.4.70.0020.02411.54
5.4.60.0030.02211.59
5.4.50.0100.02411.43
5.4.40.0040.03211.48
5.4.30.0080.02711.55
5.4.20.0080.02311.50
5.4.10.0060.02511.37
5.4.00.0050.02411.12
5.3.290.0040.02911.78
5.3.280.0080.02111.67
5.3.270.0090.03011.71
5.3.260.0080.04411.71
5.3.250.0040.02611.71
5.3.240.0050.02011.63
5.3.230.0050.02411.68
5.3.220.0040.02311.65
5.3.210.0140.03211.65
5.3.200.0050.02711.48
5.3.190.0040.02911.67
5.3.180.0070.02311.74
5.3.170.0080.02611.74
5.3.160.0050.02811.61
5.3.150.0050.02511.74
5.3.140.0080.02911.56
5.3.130.0090.03111.63
5.3.120.0100.02611.58
5.3.110.0070.03011.58
5.3.100.0070.02411.24
5.3.90.0080.02711.38
5.3.80.0060.03611.31
5.3.70.0060.02511.33
5.3.60.0100.02411.31
5.3.50.0070.03011.21
5.3.40.0070.02611.17
5.3.30.0090.02611.26
5.3.20.0070.02811.15
5.3.10.0050.02911.07
5.3.00.0060.02811.01
5.2.170.0050.0459.22
5.2.160.0060.0429.23
5.2.150.0050.0399.23
5.2.140.0060.0339.22
5.2.130.0040.0319.19
5.2.120.0050.0299.18
5.2.110.0040.0329.20
5.2.100.0070.0299.19
5.2.90.0060.0629.19
5.2.80.0060.0439.19
5.2.70.0060.0329.19
5.2.60.0040.0459.14
5.2.50.0050.0419.12
5.2.40.0040.0319.09
5.2.30.0110.0389.06
5.2.20.0100.0409.05
5.2.10.0060.0338.95
5.2.00.0110.0318.82
5.1.60.0060.0308.11
5.1.50.0060.0318.11
5.1.40.0080.0268.08
5.1.30.0110.0318.43
5.1.20.0070.0338.45
5.1.10.0060.0328.18
5.1.00.0060.0328.18
5.0.50.0080.0256.66
5.0.40.0050.0296.53
5.0.30.0040.0406.33
5.0.20.0060.0186.29
5.0.10.0030.0216.28
5.0.00.0040.0316.27
4.4.90.0020.0174.78
4.4.80.0010.0184.75
4.4.70.0040.0164.76
4.4.60.0020.0194.76
4.4.50.0020.0234.77
4.4.40.0060.0314.71
4.4.30.0090.0164.75
4.4.20.0050.0214.85
4.4.10.0050.0484.85
4.4.00.0050.0304.76
4.3.110.0070.0184.67
4.3.100.0050.0224.66
4.3.90.0040.0234.63
4.3.80.0030.0334.59
4.3.70.0030.0224.63
4.3.60.0030.0174.63
4.3.50.0040.0204.63
4.3.40.0030.0274.53
4.3.30.0040.0203.30
4.3.20.0060.0183.28
4.3.10.0020.0183.23
4.3.00.0100.01710.54

preferences:
44.65 ms | 402 KiB | 5 Q