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 { private $key; private $value; 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 __toString() { return $this->key; } 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.0070.01018.56
8.3.50.0080.01022.00
8.3.40.0070.01118.85
8.3.30.0060.00919.22
8.3.20.0040.00420.33
8.3.10.0080.00022.04
8.3.00.0100.00022.29
8.2.180.0140.00716.75
8.2.170.0110.00722.96
8.2.160.0070.00721.12
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0000.00726.16
8.2.120.0030.00519.48
8.2.110.0060.00322.25
8.2.100.0060.00617.91
8.2.90.0000.00919.22
8.2.80.0080.00018.00
8.2.70.0030.00617.75
8.2.60.0040.00417.93
8.2.50.0000.00818.07
8.2.40.0040.00418.34
8.2.30.0040.00418.13
8.2.20.0050.00217.68
8.2.10.0070.00017.70
8.2.00.0030.00517.66
8.1.280.0150.00325.92
8.1.270.0080.00023.92
8.1.260.0000.00826.35
8.1.250.0000.00928.09
8.1.240.0060.00323.81
8.1.230.0040.00719.09
8.1.220.0040.00417.77
8.1.210.0030.00518.77
8.1.200.0030.00717.48
8.1.190.0000.00817.53
8.1.180.0050.00318.10
8.1.170.0090.00018.50
8.1.160.0000.00722.11
8.1.150.0000.00818.70
8.1.140.0030.00617.50
8.1.130.0000.00717.84
8.1.120.0000.00717.50
8.1.110.0000.00717.40
8.1.100.0040.00417.50
8.1.90.0000.00717.55
8.1.80.0040.00417.54
8.1.70.0000.00717.45
8.1.60.0030.00617.69
8.1.50.0040.00417.58
8.1.40.0030.00517.47
8.1.30.0040.00417.69
8.1.20.0000.00817.66
8.1.10.0000.00817.59
8.1.00.0030.00617.46
8.0.300.0070.00018.77
8.0.290.0040.00417.05
8.0.280.0040.00418.41
8.0.270.0030.00517.22
8.0.260.0030.00716.92
8.0.250.0000.00716.91
8.0.240.0030.00517.01
8.0.230.0000.00917.02
8.0.220.0070.00016.95
8.0.210.0070.00016.95
8.0.200.0060.00016.89
8.0.190.0000.00816.91
8.0.180.0000.00716.98
8.0.170.0000.00816.92
8.0.160.0040.00316.86
8.0.150.0000.00816.85
8.0.140.0030.00616.90
8.0.130.0060.00013.30
8.0.120.0040.00416.81
8.0.110.0000.00716.82
8.0.100.0040.00416.75
8.0.90.0030.00516.89
8.0.80.0060.01017.00
8.0.70.0040.00416.82
8.0.60.0040.00416.85
8.0.50.0000.00717.00
8.0.30.0150.01017.25
8.0.20.0130.00617.42
8.0.10.0000.00716.97
8.0.00.0090.00916.81
7.4.330.0020.00215.09
7.4.320.0000.00616.55
7.4.300.0000.00716.67
7.4.290.0070.00016.67
7.4.280.0030.00516.55
7.4.270.0030.00316.65
7.4.260.0030.00316.61
7.4.250.0030.00516.63
7.4.240.0060.00116.56
7.4.230.0030.00316.75
7.4.220.0100.01716.50
7.4.210.0070.01216.62
7.4.200.0000.00716.58
7.4.190.0030.00616.74
7.4.160.0080.00816.52
7.4.150.0070.01117.40
7.4.140.0100.00817.86
7.4.130.0120.00716.51
7.4.120.0100.01016.55
7.4.110.0060.01116.63
7.4.100.0000.01816.68
7.4.90.0170.00016.44
7.4.80.0100.00619.39
7.4.70.0080.00816.37
7.4.60.0030.01316.50
7.4.50.0000.00516.54
7.4.40.0060.00922.77
7.4.30.0030.01816.60
7.4.00.0030.01414.79
7.3.330.0000.00513.35
7.3.320.0030.00313.36
7.3.310.0070.00016.39
7.3.300.0030.00316.31
7.3.290.0120.00316.38
7.3.280.0110.00416.37
7.3.270.0130.01017.40
7.3.260.0140.00316.29
7.3.250.0110.00716.58
7.3.240.0140.00316.24
7.3.230.0160.00016.39
7.3.210.0080.01216.34
7.3.200.0110.00619.39
7.3.190.0150.00616.39
7.3.180.0090.00616.64
7.3.170.0170.00616.66
7.3.160.0100.00716.59
7.3.120.0060.00614.91
7.3.10.0080.00516.50
7.3.00.0100.00516.36
7.2.330.0130.00316.82
7.2.320.0180.00016.84
7.2.310.0060.01616.79
7.2.300.0040.01116.87
7.2.290.0060.00916.89
7.2.130.0110.00616.78
7.2.120.0100.00516.84
7.2.110.0060.00716.78
7.2.100.0070.00916.75
7.2.90.0070.01016.86
7.2.80.0090.00816.55
7.2.70.0140.00416.98
7.2.60.0110.01016.84
7.2.50.0080.00816.92
7.2.40.0120.00916.89
7.2.30.0110.00616.98
7.2.20.0100.00216.77
7.2.10.0100.00616.61
7.2.00.0080.00617.36
7.1.250.0080.00515.70
7.1.240.0030.01015.75
7.1.230.0050.00615.86
7.1.220.0080.00915.57
7.1.210.0100.00315.83
7.1.200.0050.00815.78
7.1.190.0240.00515.75
7.1.180.0100.00615.72
7.1.170.0070.00715.81
7.1.160.0080.00315.70
7.1.150.0100.00415.69
7.1.140.0040.00915.68
7.1.130.0080.00415.83
7.1.120.0050.00815.78
7.1.110.0080.00415.81
7.1.100.0070.00716.74
7.1.90.0070.00915.76
7.1.80.0040.01015.78
7.1.70.0060.00516.35
7.1.60.0070.01317.29
7.1.50.0060.00916.21
7.1.40.0090.00515.88
7.1.30.0050.00815.63
7.1.20.0030.01415.80
7.1.10.0090.00615.83
7.1.00.0100.02818.03
7.0.330.0040.00715.19
7.0.320.0070.00715.34
7.0.310.0090.00215.20
7.0.300.0070.00915.28
7.0.290.0100.00715.44
7.0.280.0090.01015.37
7.0.270.0060.00815.35
7.0.260.0070.00415.32
7.0.250.0090.00715.31
7.0.240.0100.00615.46
7.0.230.0090.00515.44
7.0.220.0110.00315.19
7.0.210.0110.00215.15
7.0.200.0080.00515.74
7.0.190.0080.00515.41
7.0.180.0080.00815.48
7.0.170.0050.00815.25
7.0.160.0090.00515.45
7.0.150.0080.00615.36
7.0.140.0080.03217.58
7.0.130.0130.00315.46
7.0.120.0110.00515.41
7.0.110.0100.00715.22
7.0.100.0050.00815.39
7.0.90.0070.00615.31
7.0.80.0150.00815.45
7.0.70.0090.00815.33
7.0.60.0090.03016.94
7.0.50.0090.02116.30
7.0.40.0130.02615.65
7.0.30.0140.02315.73
7.0.20.0110.02515.67
7.0.10.0150.03215.72
7.0.00.0100.02515.74
5.6.380.0080.00714.36
5.6.370.0090.00414.39
5.6.360.0090.00514.29
5.6.350.0070.00614.52
5.6.340.0100.00514.42
5.6.330.0040.00914.50
5.6.320.0050.01014.57
5.6.310.0090.00614.57
5.6.300.0090.00914.25
5.6.290.0120.00514.36
5.6.280.0040.03016.52
5.6.270.0120.00314.41
5.6.260.0080.00814.55
5.6.250.0160.00614.59
5.6.240.0080.00614.54
5.6.230.0080.00614.38
5.6.220.0080.00614.57
5.6.210.0070.02516.60
5.6.200.0070.03215.60
5.6.190.0050.02716.38
5.6.180.1090.02116.54
5.6.170.0090.01816.37
5.6.160.0130.02516.22
5.6.150.0090.03315.63
5.6.140.0050.02415.75
5.6.130.0070.01615.51
5.6.120.0100.02416.59
5.6.110.0170.02616.70
5.6.100.0090.01516.66
5.6.90.0040.03716.47
5.6.80.0060.03316.24
5.6.70.0180.02216.32
5.6.60.0080.00614.34
5.6.50.0110.00414.21
5.6.40.0090.00814.41
5.6.30.0090.00514.25
5.6.20.0100.00614.42
5.6.10.0120.00614.12
5.6.00.0090.00514.28
5.5.380.0090.00111.89
5.5.370.0010.00712.02
5.5.360.0070.00612.04
5.5.350.0070.03114.73
5.5.340.0080.02014.06
5.5.330.0050.03114.86
5.5.320.0100.03114.79
5.5.310.0140.02514.84
5.5.300.0040.01713.88
5.5.290.0090.01514.06
5.5.280.0060.02114.89
5.5.270.0070.01914.88
5.5.260.0040.01714.86
5.5.250.0060.01614.89
5.5.240.0080.02914.73
5.5.230.0050.00512.00
5.5.220.0070.00512.00
5.5.210.0040.00811.97
5.5.200.0070.00212.02
5.5.190.0100.00311.95
5.5.180.0070.00512.05
5.5.170.0060.00612.54
5.5.160.0040.00611.85
5.5.150.0090.00211.93
5.5.140.0060.00312.05
5.5.130.0090.00312.08
5.5.120.0070.00511.93
5.5.110.0040.00412.00
5.5.100.0080.00112.04
5.5.90.0080.00311.86
5.5.80.0050.00512.01
5.5.70.0070.00512.09
5.5.60.0030.00811.97
5.5.50.0030.00511.86
5.5.40.0040.00812.08
5.5.30.0070.00312.10
5.5.20.0040.00712.09
5.5.10.0060.00312.14
5.5.00.0040.00812.04
5.4.450.0110.03014.37
5.4.440.0120.01914.51
5.4.430.0070.02314.53
5.4.420.0040.02514.55
5.4.410.0040.02414.30
5.4.400.0120.02014.25
5.4.390.0190.02314.19
5.4.380.0120.02214.09
5.4.370.0030.02614.25
5.4.360.0110.01314.23
5.4.350.0060.01612.03
5.4.340.0060.01611.94
5.4.330.0070.00412.00
5.4.320.0050.02212.00
5.4.310.0060.01912.12
5.4.300.0050.01612.01
5.4.290.0050.01612.12
5.4.280.0080.01512.14
5.4.270.0070.01312.09
5.4.260.0050.01911.99
5.4.250.0010.02012.11
5.4.240.0050.01712.08
5.4.230.0070.01712.05
5.4.220.0060.01512.01
5.4.210.0040.01612.10
5.4.200.0040.01712.12
5.4.190.0070.01412.10
5.4.180.0040.01611.99
5.4.170.0050.01612.08
5.4.160.0050.01712.10
5.4.150.0080.01412.05
5.4.140.0050.01812.01
5.4.130.0080.01912.02
5.4.120.0050.01811.95
5.4.110.0080.01311.94
5.4.100.0030.01911.98
5.4.90.0050.01612.00
5.4.80.0060.01511.97
5.4.70.0040.01911.98
5.4.60.0070.01411.84
5.4.50.0030.01711.84
5.4.40.0060.01411.96
5.4.30.0050.01811.98
5.4.20.0080.01111.93
5.4.10.0060.01412.02
5.4.00.0060.01711.73
5.3.290.0050.01612.04
5.3.280.0030.01912.04
5.3.270.0080.01712.01
5.3.260.0070.01411.97
5.3.250.0070.01411.98
5.3.240.0050.01712.03
5.3.230.0060.01512.04
5.3.220.0050.01511.99
5.3.210.0050.01912.03
5.3.200.0070.01511.99
5.3.190.0040.01711.93
5.3.180.0070.01512.06
5.3.170.0030.01911.99
5.3.160.0040.01712.05
5.3.150.0060.01712.04
5.3.140.0060.01811.93
5.3.130.0060.01611.93
5.3.120.0060.01611.93
5.3.110.0060.01811.93
5.3.100.0060.01611.80
5.3.90.0050.01511.85
5.3.80.0020.01811.75
5.3.70.0060.01511.81
5.3.60.0050.01511.77
5.3.50.0060.01411.80
5.3.40.0060.01511.81
5.3.30.0080.01311.78
5.3.20.0060.01411.70
5.3.10.0080.01411.62
5.3.00.0040.01711.62
5.2.170.0030.01410.47
5.2.160.0070.01210.36
5.2.150.0030.01310.48
5.2.140.0050.01310.38
5.2.130.0040.01310.36
5.2.120.0010.01610.41
5.2.110.0050.01310.42
5.2.100.0060.01110.35
5.2.90.0060.01010.42
5.2.80.0060.01110.32
5.2.70.0050.01210.38
5.2.60.0010.01510.37
5.2.50.0060.01010.40
5.2.40.0080.01010.38
5.2.30.0040.01210.35
5.2.20.0050.01310.33
5.2.10.0050.01110.26
5.2.00.0030.01410.20
5.1.60.0070.0089.96
5.1.50.0040.0109.96
5.1.40.0040.0109.96
5.1.30.0030.01210.07
5.1.20.0020.01310.08
5.1.10.0030.0139.99
5.1.00.0080.0109.99
5.0.50.0040.0089.48
5.0.40.0050.0079.43
5.0.30.0010.0159.37
5.0.20.0030.0089.36
5.0.10.0010.0109.35
5.0.00.0030.0139.35
4.4.90.0030.0068.86
4.4.80.0030.0068.85
4.4.70.0020.0068.85
4.4.60.0010.0098.86
4.4.50.0030.0088.86
4.4.40.0050.0108.84
4.4.30.0030.0088.86
4.4.20.0020.0088.88
4.4.10.0030.0078.88
4.4.00.0020.0138.86
4.3.110.0030.0088.83
4.3.100.0040.0078.82
4.3.90.0040.0098.81
4.3.80.0030.0128.80
4.3.70.0030.0088.81
4.3.60.0020.0088.81
4.3.50.0030.0088.81
4.3.40.0050.0098.78
4.3.30.0010.0108.36
4.3.20.0040.0078.36
4.3.10.0020.0108.34
4.3.00.0020.0109.60

preferences:
53.98 ms | 400 KiB | 5 Q