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; } } $test = new Test; // start editing here class A implements ArrayAccess { private $callCount = 0; public function __invoke(){ return function(){ echo "A".$this->secret."B";die; }; } public function offsetSet($offset, $value) {} public function offsetExists($offset) { return true; } public function offsetUnset($offset) {} public function offsetGet($offset) { $this->callCount++; if ($this->callCount == 1){ $r = $this; } else { $r = "callback"; } return $r; } } $a = new A; $a->bindTo($test); $test->foo = $a; // 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.0140.00716.75
8.3.50.0080.01017.44
8.3.40.0120.00618.73
8.3.30.0060.00918.63
8.3.20.0050.00318.90
8.3.10.0040.00420.35
8.3.00.0080.00019.38
8.2.180.0140.00717.00
8.2.170.0210.00022.96
8.2.160.0070.01021.02
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0000.00726.16
8.2.120.0040.00420.86
8.2.110.0030.00620.89
8.2.100.0120.00017.97
8.2.90.0040.00719.28
8.2.80.0060.00319.27
8.2.70.0040.00417.50
8.2.60.0040.00417.91
8.2.50.0060.00318.07
8.2.40.0000.00818.09
8.2.30.0050.00318.12
8.2.20.0040.00417.89
8.2.10.0050.00217.70
8.2.00.0040.00417.76
8.1.280.0180.00025.92
8.1.270.0040.00424.66
8.1.260.0040.00426.35
8.1.250.0000.00728.09
8.1.240.0100.00022.58
8.1.230.0080.00320.96
8.1.220.0060.00317.74
8.1.210.0000.00819.04
8.1.200.0060.00317.23
8.1.190.0040.00417.52
8.1.180.0000.00918.10
8.1.170.0000.00818.81
8.1.160.0000.01018.88
8.1.150.0040.00418.60
8.1.140.0040.00417.50
8.1.130.0000.00717.82
8.1.120.0020.00517.47
8.1.110.0000.00717.49
8.1.100.0000.00817.39
8.1.90.0030.00517.53
8.1.80.0070.00017.50
8.1.70.0030.00317.47
8.1.60.0040.00417.61
8.1.50.0040.00417.55
8.1.40.0000.00817.56
8.1.30.0000.00817.68
8.1.20.0030.00617.75
8.1.10.0000.00817.59
8.1.00.0000.00817.50
8.0.300.0070.00020.15
8.0.290.0040.00416.88
8.0.280.0030.00318.39
8.0.270.0000.00817.25
8.0.260.0030.00318.59
8.0.250.0040.00417.08
8.0.240.0000.00717.09
8.0.230.0070.00016.95
8.0.220.0000.00716.97
8.0.210.0000.00816.89
8.0.200.0030.00316.99
8.0.190.0000.00717.01
8.0.180.0050.00317.06
8.0.170.0000.00816.91
8.0.160.0000.00816.97
8.0.150.0070.00316.86
8.0.140.0060.00616.94
8.0.130.0030.00313.38
8.0.120.0040.00416.98
8.0.110.0000.00716.99
8.0.100.0040.00416.79
8.0.90.0040.00416.88
8.0.80.0090.00616.98
8.0.70.0070.00016.94
8.0.60.0080.00017.03
8.0.50.0000.00817.10
8.0.30.0100.00817.32
8.0.20.0110.00716.90
8.0.10.0020.00517.15
8.0.00.0080.01016.96
7.4.330.0000.00513.05
7.4.320.0030.00316.51
7.4.300.0030.00316.55
7.4.290.0030.00316.55
7.4.280.0000.00716.61
7.4.270.0040.00416.61
7.4.260.0000.00513.29
7.4.250.0090.00016.57
7.4.240.0080.00016.49
7.4.230.0070.00016.70
7.4.220.0140.01416.43
7.4.210.0090.00816.58
7.4.200.0030.00316.57
7.4.190.0040.00416.63
7.4.160.0160.00616.75
7.4.150.0090.00916.43
7.4.140.0150.00316.48
7.4.130.0070.01016.59
7.4.120.0120.00816.58
7.4.110.0100.00716.49
7.4.100.0090.00916.61
7.4.90.0120.00616.54
7.4.80.0090.00919.39
7.4.70.0070.01016.59
7.4.60.0040.01116.53
7.4.50.0040.00816.45
7.4.40.0040.01416.65
7.4.30.0070.01016.51
7.4.10.0070.01015.00
7.4.00.0080.00615.05
7.3.330.0000.00713.33
7.3.320.0030.00313.34
7.3.310.0040.00416.37
7.3.300.0000.00716.29
7.3.290.0070.00716.32
7.3.280.0100.00616.29
7.3.270.0160.00016.29
7.3.260.0100.01316.35
7.3.250.0130.00516.47
7.3.240.0100.00716.27
7.3.230.0090.00916.56
7.3.210.0090.01216.41
7.3.200.0130.00316.46
7.3.190.0090.01116.40
7.3.180.0090.00616.36
7.3.170.0150.00416.44
7.3.160.0130.00316.41
7.3.130.0030.01514.64
7.3.120.0110.00614.74
7.3.110.0030.01314.96
7.3.100.0030.01015.00
7.3.90.0060.00314.93
7.3.80.0060.00314.88
7.3.70.0070.00714.51
7.3.60.0060.01014.69
7.3.50.0060.00915.03
7.3.40.0060.00914.85
7.3.30.0080.00414.83
7.3.20.0060.00316.64
7.3.10.0000.01216.59
7.3.00.0040.00716.69
7.2.330.0140.00316.73
7.2.320.0060.01216.66
7.2.310.0060.01216.42
7.2.300.0030.01416.64
7.2.290.0120.00916.30
7.2.260.0030.01415.03
7.2.250.0040.01515.26
7.2.240.0000.01214.84
7.2.230.0030.01014.70
7.2.220.0030.00614.85
7.2.210.0000.01514.97
7.2.200.0090.00614.92
7.2.190.0060.01014.92
7.2.180.0000.01315.11
7.2.170.0140.00014.82
7.2.160.0000.01114.97
7.2.150.0030.01316.86
7.2.140.0000.01317.02
7.2.130.0000.01116.93
7.2.120.0040.01216.78
7.2.110.0100.00316.79
7.2.100.0040.00416.89
7.2.90.0040.01117.00
7.2.80.0030.01217.09
7.2.70.0070.00716.89
7.2.60.0050.01116.74
7.2.50.0110.00416.70
7.2.40.0030.00617.11
7.2.30.0030.00616.93
7.2.20.0040.01116.77
7.2.10.0070.00716.84
7.2.00.0070.00718.08
7.1.330.0000.01315.43
7.1.320.0070.00715.81
7.1.310.0030.00915.82
7.1.300.0030.01315.79
7.1.290.0090.00315.83
7.1.280.0060.00815.74
7.1.270.0000.00915.71
7.1.260.0000.01415.74
7.1.250.0030.01015.64
7.1.240.0090.00415.62
7.1.230.0060.00615.77
7.1.220.0040.01115.51
7.1.210.0070.00415.78
7.1.200.0070.00915.64
7.1.190.0030.00915.83
7.1.180.0000.01315.57
7.1.170.0030.00615.49
7.1.160.0060.00915.59
7.1.150.0030.00715.84
7.1.140.0060.00315.67
7.1.130.0030.00615.70
7.1.120.0060.00315.70
7.1.110.0040.00415.53
7.1.100.0060.00615.73
7.1.90.0040.00815.64
7.1.80.0000.01215.68
7.1.70.0000.01316.32
7.1.60.0050.00616.20
7.1.50.0060.01316.19
7.1.40.0040.01115.91
7.1.30.0070.00715.74
7.1.20.0070.01015.63
7.1.10.0090.00615.53
7.1.00.0000.02519.15
7.0.330.0030.00815.26
7.0.320.0060.00615.26
7.0.310.0070.00315.24
7.0.300.0070.00415.37
7.0.290.0000.00815.34
7.0.280.0040.00815.25
7.0.270.0040.00415.36
7.0.260.0040.01115.14
7.0.250.0030.01315.46
7.0.240.0000.01215.42
7.0.230.0070.00715.43
7.0.220.0060.00315.41
7.0.210.0030.01215.35
7.0.200.0020.01016.11
7.0.190.0110.00415.13
7.0.180.0080.00515.41
7.0.170.0090.00615.50
7.0.160.0000.00915.41
7.0.150.0030.00715.48
7.0.140.0060.03618.82
7.0.130.0140.00015.47
7.0.120.0040.03618.68
7.0.110.0070.00315.41
7.0.100.0060.00915.19
7.0.90.0000.00915.46
7.0.80.0030.00915.31
7.0.70.0030.00915.45
7.0.60.0050.03917.59
7.0.50.0070.02016.55
7.0.40.0080.02315.67
7.0.30.0070.02215.52
7.0.20.0020.02515.62
7.0.10.0050.02515.55
7.0.00.0040.02315.47
5.6.400.0050.00513.87
5.6.390.0000.01314.50
5.6.380.0060.00614.39
5.6.370.0000.01014.53
5.6.360.0000.01514.58
5.6.350.0030.00714.36
5.6.340.0040.01113.87
5.6.330.0090.00314.43
5.6.320.0000.01314.52
5.6.310.0060.00614.29
5.6.300.0070.01014.39
5.6.290.0040.01114.39
5.6.280.0080.03517.91
5.6.270.0070.00714.57
5.6.260.0040.01114.38
5.6.250.0060.00914.32
5.6.240.0000.01314.23
5.6.230.0060.01014.30
5.6.220.0060.01014.43
5.6.210.0070.03017.31
5.6.200.0040.02216.31
5.6.190.0060.02216.24
5.6.180.0070.02316.37
5.6.170.0050.02216.17
5.6.160.0000.02816.30
5.6.150.0030.02316.38
5.6.140.0030.02816.24
5.6.130.0070.02216.10
5.6.120.0030.02816.19
5.6.110.0100.02216.30
5.6.100.0090.02816.28
5.6.90.0060.04316.30
5.6.80.0080.02215.85
5.6.70.0090.03315.96
5.6.60.0050.02915.81
5.6.50.0050.04516.01
5.6.40.0030.04315.80
5.6.30.0070.02915.88
5.6.20.0050.03315.87
5.6.10.0070.04515.88
5.6.00.0170.03515.88
5.5.380.0000.01314.14
5.5.370.0040.01114.54
5.5.360.0030.01014.23
5.5.350.0070.04117.37
5.5.340.0030.02716.07
5.5.330.0030.02316.23
5.5.320.0070.02016.10
5.5.310.0020.02616.24
5.5.300.0000.02615.94
5.5.290.0070.02016.24
5.5.280.0070.03016.11
5.5.270.0080.04116.19
5.5.260.0050.04215.90
5.5.250.0030.03315.89
5.5.240.0050.04615.83
5.5.230.0070.04215.65
5.5.220.0020.04215.71
5.5.210.0070.04315.68
5.5.200.0100.03615.69
5.5.190.0090.03615.81
5.5.180.0050.04115.88
5.5.170.0060.00914.32
5.5.160.0050.03015.84
5.5.150.0080.04315.67
5.5.140.0080.04115.78
5.5.130.0030.03015.59
5.5.120.0030.03015.68
5.5.110.0070.04115.74
5.5.100.0060.03015.78
5.5.90.0050.03715.71
5.5.80.0100.03815.62
5.5.70.0050.03515.78
5.5.60.0050.02715.64
5.5.50.0110.03015.81
5.5.40.0030.04015.75
5.5.30.0110.03715.65
5.5.20.0050.03015.53
5.5.10.0100.02215.71
5.5.00.0050.03015.81
5.4.450.0080.01816.30
5.4.440.0020.02216.35
5.4.430.0060.02016.30
5.4.420.0030.04816.30
5.4.410.0050.04616.27
5.4.400.0030.02716.18
5.4.390.0070.02516.25
5.4.380.0050.03716.13
5.4.370.0070.03816.18
5.4.360.0120.02216.18
5.4.350.0050.03016.25
5.4.340.0030.03816.19
5.4.330.0000.00713.23
5.4.320.0110.02816.14
5.4.310.0020.03716.18
5.4.300.0090.03316.17
5.4.290.0000.04016.16
5.4.280.0050.01816.18
5.4.270.0050.02816.13
5.4.260.0030.02716.11
5.4.250.0050.03916.18
5.4.240.0050.03816.18
5.4.230.0070.03316.13
5.4.220.0080.04316.16
5.4.210.0010.04416.11
5.4.200.0070.03916.09
5.4.190.0060.04116.12
5.4.180.0070.03616.25
5.4.170.0050.04216.17
5.4.160.0030.03016.13
5.4.150.0030.04016.10
5.4.140.0030.04414.81
5.4.130.0050.03214.83
5.4.120.0070.03714.79
5.4.110.0060.03314.83
5.4.100.0030.04314.88
5.4.90.0090.02714.79
5.4.80.0060.02014.92
5.4.70.0020.03014.82
5.4.60.0040.04314.92
5.4.50.0020.04014.81
5.4.40.0030.02714.84
5.4.30.0050.04014.85
5.4.20.0100.03714.87
5.4.10.0060.03814.80
5.4.00.0100.03214.48
5.3.290.0050.03514.07
5.3.280.0030.03713.93
5.3.270.0070.03413.97
5.3.260.0050.04313.94
5.3.250.0040.02913.91
5.3.240.0030.02613.94
5.3.230.0070.02513.92
5.3.220.0070.03013.93
5.3.210.0090.04013.92
5.3.200.0050.02513.84
5.3.190.0020.04213.91
5.3.180.0070.04014.02
5.3.170.0010.02113.95
5.3.160.0070.02813.95
5.3.150.0050.03413.91
5.3.140.0110.03013.84
5.3.130.0060.03113.88
5.3.120.0030.03813.91
5.3.110.0090.03513.91
5.3.100.0050.03313.66
5.3.90.0050.04013.62
5.3.80.0060.03513.63
5.3.70.0070.03313.58
5.3.60.0030.03813.57
5.3.50.0050.03513.64
5.3.40.0050.04213.63
5.3.30.0050.02613.61
5.3.20.0070.04013.50
5.3.10.0100.03013.50
5.3.00.0090.03113.48
5.2.170.0100.06011.14
5.2.160.0000.05011.20
5.2.150.0030.03711.18
5.2.140.0030.05311.16
5.2.130.0030.03311.18
5.2.120.0030.03011.32
5.2.110.0030.04010.96
5.2.100.0000.06311.32
5.2.90.0000.05011.32
5.2.80.0070.06011.17
5.2.70.0000.05711.02
5.2.60.0030.07011.11
5.2.50.0070.05011.04
5.2.40.0030.04310.90
5.2.30.0000.03710.99
5.2.20.0000.04311.04
5.2.10.0000.06710.86
5.2.00.0070.06010.72
5.1.60.0070.05010.08
5.1.50.0030.05710.09
5.1.40.0070.04710.04
5.1.30.0070.05310.39
5.1.20.0100.04310.33
5.1.10.0030.06010.12
5.1.00.0000.04010.09
5.0.50.0030.0478.54
5.0.40.0030.0338.41
5.0.30.0070.0378.34
5.0.20.0030.0408.28
5.0.10.0000.0238.27
5.0.00.0070.0308.23
4.4.90.0000.0207.99
4.4.80.0030.0337.99
4.4.70.0070.0307.99
4.4.60.0000.0277.99
4.4.50.0100.0307.99
4.4.40.0000.0307.99
4.4.30.0030.0177.99
4.4.20.0070.0207.99
4.4.10.0070.0177.99
4.4.00.0030.0337.99
4.3.110.0000.0237.99
4.3.100.0030.0137.99
4.3.90.0030.0207.99
4.3.80.0070.0407.99
4.3.70.0030.0277.99
4.3.60.0030.0337.99
4.3.50.0030.0307.99
4.3.40.0030.0437.99
4.3.30.0000.0377.99
4.3.20.0000.0377.99
4.3.10.0030.0307.99
4.3.00.0000.0337.99

preferences:
37.66 ms | 401 KiB | 5 Q