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 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 Infiltrator implements ArrayAccess { public function __construct($target) { $this->target = $target; } public function sneak($key, $value) { $this->key = $key; $this->value = $value; $this->target->$key = $this; } public function offsetGet($offset) { return $this->key; } public function offsetExists($offset) {} public function offsetSet($offset, $value) {} public function offsetUnset($offset) {} public function __invoke() { return $this->value; } } $infiltrator = new Infiltrator($test); $infiltrator->sneak('callback', function() {}); $infiltrator->sneak('secret', 'I’m in! Send backup!'); // 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.0090.00918.81
8.3.50.0070.01022.00
8.3.40.0140.00318.96
8.3.30.0140.00019.05
8.3.20.0030.00520.33
8.3.10.0080.00021.95
8.3.00.0000.00822.52
8.2.180.0110.00416.63
8.2.170.0160.00022.96
8.2.160.0110.00421.07
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0080.00017.88
8.2.110.0090.00020.94
8.2.100.0070.00417.72
8.2.90.0080.00019.21
8.2.80.0000.00917.97
8.2.70.0000.00817.61
8.2.60.0000.00818.16
8.2.50.0040.00418.07
8.2.40.0040.00418.22
8.2.30.0040.00418.35
8.2.20.0040.00417.78
8.2.10.0090.00019.58
8.2.00.0000.00717.79
8.1.280.0040.01125.92
8.1.270.0040.00421.94
8.1.260.0060.00326.35
8.1.250.0000.01028.09
8.1.240.0000.00921.25
8.1.230.0070.00417.42
8.1.220.0040.00417.74
8.1.210.0080.00018.77
8.1.200.0060.00317.48
8.1.190.0030.00517.13
8.1.180.0040.00418.10
8.1.170.0030.00518.68
8.1.160.0080.00021.98
8.1.150.0040.00418.72
8.1.140.0070.00017.43
8.1.130.0030.00317.94
8.1.120.0000.00717.42
8.1.110.0030.00317.47
8.1.100.0000.00817.39
8.1.90.0000.00717.48
8.1.80.0040.00417.51
8.1.70.0000.00717.46
8.1.60.0040.00417.67
8.1.50.0050.00317.50
8.1.40.0040.00417.52
8.1.30.0000.00817.71
8.1.20.0030.00617.59
8.1.10.0050.00317.67
8.1.00.0090.00017.56
8.0.300.0000.00718.77
8.0.290.0060.00316.75
8.0.280.0000.00718.49
8.0.270.0000.00717.25
8.0.260.0000.00816.80
8.0.250.0000.00817.03
8.0.240.0040.00417.05
8.0.230.0030.00316.99
8.0.220.0040.00417.04
8.0.210.0000.00716.82
8.0.200.0000.00717.00
8.0.190.0000.00716.99
8.0.180.0070.00016.91
8.0.170.0060.00317.00
8.0.160.0000.00716.90
8.0.150.0040.00416.88
8.0.140.0040.00416.77
8.0.130.0030.00313.32
8.0.120.0000.00816.97
8.0.110.0040.00416.94
8.0.100.0080.00016.98
8.0.90.0040.00416.92
8.0.80.0060.01016.89
8.0.70.0030.00516.94
8.0.60.0040.00416.99
8.0.50.0080.00016.92
8.0.30.0120.00917.27
8.0.20.0030.01717.40
8.0.10.0040.00417.02
8.0.00.0120.00516.79
7.4.330.0020.00215.09
7.4.320.0000.00716.48
7.4.300.0040.00416.55
7.4.290.0030.00316.45
7.4.280.0030.00316.65
7.4.270.0000.00716.56
7.4.260.0040.00416.54
7.4.250.0080.00016.65
7.4.240.0050.00216.65
7.4.230.0050.00316.66
7.4.220.0090.00916.66
7.4.210.0110.00416.58
7.4.200.0030.00316.77
7.4.190.0000.00716.57
7.4.160.0070.01016.63
7.4.150.0090.00917.40
7.4.140.0070.01017.86
7.4.130.0090.01016.52
7.4.120.0120.00616.55
7.4.110.0090.00916.59
7.4.100.0060.01016.73
7.4.90.0030.01616.50
7.4.80.0030.02319.39
7.4.70.0070.01116.68
7.4.60.0030.01316.64
7.4.50.0040.01016.43
7.4.40.0110.00422.77
7.4.30.0160.00016.60
7.4.00.0030.01415.24
7.3.330.0050.00013.41
7.3.320.0030.00313.23
7.3.310.0050.00216.41
7.3.300.0000.00716.36
7.3.290.0110.00316.40
7.3.280.0070.00816.38
7.3.270.0150.00917.40
7.3.260.0250.01416.28
7.3.250.0030.01416.57
7.3.240.0090.01216.37
7.3.230.0060.00916.39
7.3.210.0100.00716.37
7.3.200.0060.01119.39
7.3.190.0030.01616.57
7.3.180.0060.01016.39
7.3.170.0030.01516.41
7.3.160.0190.00316.48
7.3.120.0060.00914.84
7.3.110.0060.01014.91
7.3.100.0000.01515.12
7.3.90.0170.00015.06
7.3.80.0000.01514.76
7.3.70.0030.01114.88
7.3.60.0070.00714.93
7.3.50.0060.00614.80
7.3.40.0100.00615.02
7.3.30.0070.00714.95
7.3.20.0000.01416.33
7.3.10.0070.00716.74
7.3.00.0030.01316.85
7.2.330.0070.01016.63
7.2.320.0030.01416.37
7.2.310.0120.00616.71
7.2.300.0090.00616.61
7.2.290.0040.01116.66
7.2.240.0030.01215.07
7.2.230.0040.00715.21
7.2.220.0030.01415.33
7.2.210.0070.01015.23
7.2.200.0030.01014.96
7.2.190.0040.01114.84
7.2.180.0040.01115.13
7.2.170.0030.01015.11
7.2.160.0060.00615.05
7.2.150.0100.00616.96
7.2.140.0040.01117.07
7.2.130.0040.01116.84
7.2.120.0060.00617.15
7.2.110.0070.01016.68
7.2.100.0100.00017.02
7.2.90.0040.00916.83
7.2.80.0040.01117.09
7.2.70.0000.01316.68
7.2.60.0070.00516.75
7.2.50.0040.01216.79
7.2.40.0090.00417.02
7.2.30.0050.00517.05
7.2.20.0030.01416.77
7.2.10.0060.01016.91
7.2.00.0030.00718.23
7.1.330.0030.01215.92
7.1.320.0040.01115.73
7.1.310.0100.00715.94
7.1.300.0060.00615.78
7.1.290.0030.00815.85
7.1.280.0060.00915.78
7.1.270.0100.00315.72
7.1.260.0040.00815.86
7.1.250.0060.00615.80
7.1.200.0060.00615.79
7.1.100.0030.01318.17
7.1.70.0030.00717.20
7.1.60.0110.00619.82
7.1.50.0100.01317.05
7.1.00.0070.07322.46
7.0.200.0030.00816.90
7.0.140.0070.07322.09
7.0.60.0070.08320.10
7.0.50.0230.07017.87
7.0.40.0100.08320.27
7.0.30.0230.05320.09
7.0.20.0270.07020.05
7.0.10.0030.07720.14
7.0.00.0100.06020.14
5.6.280.0000.07720.83
5.6.210.0070.04020.73
5.6.200.0000.09018.27
5.6.190.0070.05320.77
5.6.180.0300.04020.66
5.6.170.0430.04020.47
5.6.160.0070.04320.51
5.6.150.0000.05718.18
5.6.140.0070.08018.18
5.6.130.0070.08318.24
5.6.120.0000.04321.16
5.6.110.0100.08021.02
5.6.100.0030.07321.06
5.6.90.0030.08721.02
5.6.80.0000.04720.49
5.5.350.0100.05020.54
5.5.340.0100.04018.05
5.5.330.0000.04720.21
5.5.320.0270.04320.35
5.5.310.0300.07720.30
5.5.300.0130.07717.93
5.5.290.0130.07717.98
5.5.280.0130.04720.89
5.5.270.0030.06020.77
5.5.260.0070.03720.88
5.5.250.0070.08720.70
5.5.240.0030.07020.30
5.4.450.0630.05019.45
5.4.440.1000.05019.49
5.4.430.0830.06319.54
5.4.420.0870.07319.16
5.4.410.0970.06019.47
5.4.400.0800.05719.28
5.4.390.0730.06719.15
5.4.380.0330.04018.74
5.4.370.0230.04318.46
5.4.360.0130.04718.63
5.4.350.0080.04012.04
5.4.340.0050.04012.03
5.4.320.0110.03112.52
5.4.310.0050.04012.51
5.4.300.0060.03612.52
5.4.290.0040.04012.52
5.4.280.0080.03212.41
5.4.270.0030.04512.38
5.4.260.0050.03812.38
5.4.250.0080.03712.38
5.4.240.0070.03412.38
5.4.230.0080.03512.37
5.4.220.0070.03512.38
5.4.210.0030.03812.37
5.4.200.0060.04012.38
5.4.190.0060.03612.37
5.4.180.0050.03612.37
5.4.170.0050.03612.38
5.4.160.0040.03812.37
5.4.150.0070.03612.37
5.4.140.0080.04512.05
5.4.130.0100.04512.04
5.4.120.0060.03611.99
5.4.110.0060.03812.00
5.4.100.0060.03611.99
5.4.90.0080.03811.99
5.4.80.0050.03612.00
5.4.70.0090.03711.99
5.4.60.0060.03811.99
5.4.50.0040.04011.98
5.4.40.0050.03811.97
5.4.30.0050.03611.97
5.4.20.0040.03811.96
5.4.10.0060.03511.97
5.4.00.0070.03611.46
5.3.290.0060.04012.80
5.3.280.0080.03612.71
5.3.270.0110.03412.72
5.3.260.0030.04212.72
5.3.250.0050.03712.72
5.3.240.0070.03512.72
5.3.230.0060.03812.71
5.3.220.0060.03812.68
5.3.210.0060.04212.68
5.3.200.0050.03712.68
5.3.190.0060.03712.68
5.3.180.0060.03712.68
5.3.170.0050.03712.67
5.3.160.0040.03912.67
5.3.150.0060.03712.67
5.3.140.0050.03712.66
5.3.130.0050.04212.66
5.3.120.0090.04412.65
5.3.110.0070.03912.66
5.3.100.0140.06312.12
5.3.90.0070.04112.09
5.3.80.0070.03712.07
5.3.70.0070.03512.07
5.3.60.0060.03712.07
5.3.50.0060.03612.00
5.3.40.0050.03912.00
5.3.30.0070.03511.97
5.3.20.0060.03511.75
5.3.10.0080.03311.71
5.3.00.0070.03411.70
5.2.170.0020.0339.20
5.2.160.0060.0279.20
5.2.150.0050.0309.20
5.2.140.0070.0289.20
5.2.130.0030.0339.16
5.2.120.0060.0279.16
5.2.110.0020.0329.16
5.2.100.0030.0309.16
5.2.90.0050.0319.16
5.2.80.0040.0329.16
5.2.70.0060.0309.15
5.2.60.0050.0309.11
5.2.50.0020.0329.09
5.2.40.0060.0269.05
5.2.30.0060.0279.03
5.2.20.0040.0319.02
5.2.10.0080.0258.93
5.2.00.0050.0308.79
5.1.60.0050.0228.08
5.1.50.0030.0258.08
5.1.40.0020.0268.06
5.1.30.0030.0278.41
5.1.20.0040.0358.43
5.1.10.0030.0288.15
5.1.00.0070.0248.15
5.0.50.0040.0276.63
5.0.40.0070.0176.49
5.0.30.0040.0316.30
5.0.20.0040.0206.28
5.0.10.0060.0176.25
5.0.00.0040.0306.24
4.4.90.0010.0174.78
4.4.80.0040.0154.76
4.4.70.0020.0164.76
4.4.60.0020.0164.76
4.4.50.0030.0154.77
4.4.40.0020.0264.71
4.4.30.0040.0144.76
4.4.20.0010.0174.84
4.4.10.0040.0154.85
4.4.00.0010.0274.76
4.3.110.0050.0144.67
4.3.100.0030.0144.66
4.3.90.0030.0154.63
4.3.80.0030.0244.58
4.3.70.0010.0164.63
4.3.60.0020.0154.63
4.3.50.0010.0174.63
4.3.40.0010.0264.53
4.3.30.0030.0163.29
4.3.20.0010.0183.26
4.3.10.0030.0143.23
4.3.00.0230.0176.98

preferences:
46.37 ms | 401 KiB | 5 Q