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 foo implements ArrayAccess { private $bar = array('a', 'b', 'callback', 'time', 'c', 'secret', 'whatever'); public function offsetExists ( $offset ) { return true; } public function offsetGet ( $offset ) { return next($this->bar); } public function offsetSet ( $offset, $value ) { } public function offsetUnset ( $offset ) { } public function __invoke() { return next($this->bar); } } $foo = array(); $foo(); $tree = new foo(); $test->hack = $tree; $test->hack = $tree; // 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.0140.00316.61
8.3.60.0040.01118.49
8.3.50.0110.00821.15
8.3.40.0110.01118.84
8.3.30.0040.01119.09
8.3.20.0040.00420.39
8.3.10.0040.00422.09
8.3.00.0050.00322.50
8.2.180.0070.00716.88
8.2.170.0110.00322.96
8.2.160.0070.00719.33
8.2.150.0000.00824.18
8.2.140.0080.00024.66
8.2.130.0000.00826.16
8.2.120.0000.00819.54
8.2.110.0060.00322.21
8.2.100.0080.00317.87
8.2.90.0040.00419.21
8.2.80.0050.00317.97
8.2.70.0000.00817.63
8.2.60.0060.00317.80
8.2.50.0060.00318.07
8.2.40.0030.00518.34
8.2.30.0050.00318.11
8.2.20.0040.00417.63
8.2.10.0030.00617.83
8.2.00.0050.00317.76
8.1.280.0060.01025.92
8.1.270.0090.00018.57
8.1.260.0050.00326.35
8.1.250.0000.00928.09
8.1.240.0060.00621.25
8.1.230.0060.00617.42
8.1.220.0040.00417.74
8.1.210.0030.00518.77
8.1.200.0090.00017.35
8.1.190.0030.00517.53
8.1.180.0030.00618.80
8.1.170.0030.00818.46
8.1.160.0020.00522.11
8.1.150.0040.00418.71
8.1.140.0040.00417.48
8.1.130.0050.00317.82
8.1.120.0040.00417.51
8.1.110.0040.00417.54
8.1.100.0030.00317.47
8.1.90.0100.00017.38
8.1.80.0040.00417.48
8.1.70.0000.00717.50
8.1.60.0100.00017.47
8.1.50.0030.00517.44
8.1.40.0060.00317.54
8.1.30.0000.00817.62
8.1.20.0040.00417.55
8.1.10.0050.00317.50
8.1.00.0030.00617.47
8.0.300.0040.00418.77
8.0.290.0050.00216.75
8.0.280.0070.00018.50
8.0.270.0030.00317.29
8.0.260.0000.00716.91
8.0.250.0030.00317.07
8.0.240.0060.00317.08
8.0.230.0000.00716.97
8.0.220.0070.00017.02
8.0.210.0000.00716.85
8.0.200.0000.00617.02
8.0.190.0070.00316.95
8.0.180.0000.00716.90
8.0.170.0090.00016.99
8.0.160.0000.00716.98
8.0.150.0050.00316.97
8.0.140.0000.00816.95
8.0.130.0050.00013.41
8.0.120.0060.00317.00
8.0.110.0020.00516.95
8.0.100.0040.00416.85
8.0.90.0040.00417.07
8.0.80.0070.01017.00
8.0.70.0040.00417.02
8.0.60.0030.00516.77
8.0.50.0000.00816.87
8.0.30.0110.00817.27
8.0.20.0080.01017.44
8.0.10.0040.00416.93
8.0.00.0060.01416.88
7.4.330.0050.00015.00
7.4.320.0030.00316.65
7.4.300.0040.00416.65
7.4.290.0030.00516.63
7.4.280.0000.00716.53
7.4.270.0070.00016.50
7.4.260.0030.00316.41
7.4.250.0000.00816.60
7.4.240.0050.00216.58
7.4.230.0050.00316.47
7.4.220.0070.01116.73
7.4.210.0060.01116.63
7.4.200.0050.00216.52
7.4.190.0040.00416.64
7.4.160.0060.01116.49
7.4.150.0100.00717.40
7.4.140.0070.01017.86
7.4.130.0110.00816.63
7.4.120.0100.01016.61
7.4.110.0120.01116.54
7.4.100.0090.00916.61
7.4.90.0110.01116.70
7.4.80.0060.01619.39
7.4.70.0030.01516.50
7.4.60.0070.01016.69
7.4.50.0000.00816.65
7.4.40.0070.00722.77
7.4.30.0060.01016.63
7.4.00.0070.01015.09
7.3.330.0000.00513.33
7.3.320.0000.00613.39
7.3.310.0000.00716.16
7.3.300.0020.00516.18
7.3.290.0030.01216.35
7.3.280.0090.00916.34
7.3.270.0100.00917.40
7.3.260.0120.00616.39
7.3.250.0090.00816.46
7.3.240.0100.01316.57
7.3.230.0070.01116.57
7.3.210.0130.00316.57
7.3.200.0090.01219.39
7.3.190.0120.00616.49
7.3.180.0110.00416.51
7.3.170.0040.01116.47
7.3.160.0060.01016.35
7.3.120.0110.00415.00
7.3.10.0070.01016.58
7.3.00.0060.00616.70
7.2.330.0070.01016.39
7.2.320.0120.00616.75
7.2.310.0140.01116.48
7.2.300.0070.01016.79
7.2.290.0040.01216.55
7.2.130.0060.00616.78
7.2.120.0040.01116.92
7.2.110.0070.00716.98
7.2.100.0030.00616.60
7.2.90.0040.01117.05
7.2.80.0040.01116.91
7.2.70.0060.00916.88
7.2.60.0070.00616.78
7.2.50.0030.01016.91
7.2.40.0040.00716.86
7.2.30.0040.00816.80
7.2.20.0100.00617.05
7.2.10.0030.01216.67
7.2.00.0080.00817.97
7.1.250.0040.01115.65
7.1.240.0030.01015.72
7.1.230.0060.00615.52
7.1.220.0030.01315.63
7.1.210.0110.00315.69
7.1.200.0050.00515.59
7.1.190.0040.01115.48
7.1.180.0000.01415.68
7.1.170.0040.00415.62
7.1.160.0090.00615.45
7.1.150.0060.00915.50
7.1.140.0040.01215.77
7.1.130.0070.00315.71
7.1.120.0040.01115.38
7.1.110.0000.00815.80
7.1.100.0130.00015.57
7.1.90.0000.01515.70
7.1.80.0070.00715.84
7.1.70.0000.01016.16
7.1.60.0080.00416.44
7.1.50.0140.00516.37
7.1.40.0040.01115.80
7.1.30.0030.01015.68
7.1.20.0050.00515.75
7.1.10.0110.00415.26
7.1.00.0050.02218.88
7.0.330.0030.00615.15
7.0.320.0070.00315.21
7.0.310.0030.00615.38
7.0.300.0090.00615.36
7.0.290.0060.00615.50
7.0.280.0040.01115.32
7.0.270.0030.01215.43
7.0.260.0000.01215.19
7.0.250.0060.00315.45
7.0.240.0000.01115.25
7.0.230.0030.00714.94
7.0.220.0060.00915.36
7.0.210.0060.01115.20
7.0.200.0080.01015.94
7.0.190.0130.00015.10
7.0.180.0120.00015.30
7.0.170.0130.00015.36
7.0.160.0000.01215.14
7.0.150.0060.00915.30
7.0.140.0030.04318.52
7.0.130.0030.00615.31
7.0.120.0060.00915.36
7.0.110.0060.00615.05
7.0.100.0030.01014.99
7.0.90.0060.00615.45
7.0.80.0000.01215.25
7.0.70.0060.00915.39
7.0.60.0050.03717.68
7.0.50.0070.02216.52
7.0.40.0050.02716.79
7.0.30.0190.04116.72
7.0.20.0150.03016.74
7.0.10.0120.02116.82
7.0.00.0080.03216.78
5.6.380.0040.01114.12
5.6.370.0090.00914.22
5.6.360.0000.01014.36
5.6.350.0030.00614.45
5.6.340.0110.00314.52
5.6.330.0130.00013.99
5.6.320.0070.01014.32
5.6.310.0070.00714.28
5.6.300.0060.00314.32
5.6.290.0080.00814.52
5.6.280.0020.04417.71
5.6.270.0000.01514.13
5.6.260.0000.00814.46
5.6.250.0060.00314.28
5.6.240.0070.00714.51
5.6.230.0060.00914.16
5.6.220.0030.01014.38
5.6.210.0070.02317.36
5.6.200.0050.03316.30
5.6.190.0030.03917.47
5.6.180.2000.02517.43
5.6.170.0190.02617.40
5.6.160.0110.04117.56
5.6.150.0080.03616.28
5.6.140.0020.03816.13
5.6.130.0120.04216.28
5.6.120.0050.04817.63
5.6.110.0070.02717.75
5.6.100.0050.02517.64
5.6.90.0110.03017.76
5.6.80.0020.03217.37
5.6.70.0100.04417.38
5.6.60.0040.00814.08
5.6.50.0000.01114.10
5.6.40.0070.00714.30
5.6.30.0030.00914.25
5.6.20.0100.00614.30
5.6.10.0070.00714.13
5.6.00.0030.01414.28
5.5.380.0040.00810.90
5.5.370.0060.00011.20
5.5.360.0000.01111.07
5.5.350.0190.02015.65
5.5.340.0030.02514.58
5.5.330.0030.04915.64
5.5.320.0220.03515.56
5.5.310.0170.03215.76
5.5.300.0040.02714.39
5.5.290.0070.03914.64
5.5.280.0070.03515.79
5.5.270.0050.02315.89
5.5.260.0070.03515.92
5.5.250.0100.03115.95
5.5.240.0020.02615.51
5.5.230.0000.00611.13
5.5.220.0030.00310.85
5.5.210.0000.01211.08
5.5.200.0040.00410.87
5.5.190.0000.00810.96
5.5.180.0050.00311.17
5.5.170.0030.00610.96
5.5.160.0000.00710.87
5.5.150.0070.00310.95
5.5.140.0100.00010.63
5.5.130.0040.00911.05
5.5.120.0060.00611.13
5.5.110.0000.01011.03
5.5.100.0080.00311.16
5.5.90.0080.00310.82
5.5.80.0030.01010.87
5.5.70.0000.01011.13
5.5.60.0070.00311.04
5.5.50.0000.00611.08
5.5.40.0000.00710.98
5.5.30.0000.01111.16
5.5.20.0030.00310.67
5.5.10.0030.00911.20
5.5.00.0100.00311.10
5.4.450.0400.03315.40
5.4.440.0200.03015.32
5.4.430.0420.03715.19
5.4.420.0440.02715.45
5.4.410.0570.04015.23
5.4.400.0670.03814.69
5.4.390.0660.02614.76
5.4.380.0180.02714.63
5.4.370.0130.02714.85
5.4.360.0130.02514.55
5.4.350.0130.02714.63
5.4.340.0080.03014.65
5.4.330.0030.00710.81
5.4.320.0040.02211.72
5.4.310.0060.02511.78
5.4.300.0060.02311.73
5.4.290.0040.02111.79
5.4.280.0040.02211.76
5.4.270.0040.02211.57
5.4.260.0040.02211.61
5.4.250.0050.03214.95
5.4.240.0030.03514.91
5.4.230.0050.03714.73
5.4.220.0000.03714.69
5.4.210.0120.02514.89
5.4.200.0050.03714.68
5.4.190.0070.02614.87
5.4.180.0040.03114.86
5.4.170.0080.02714.99
5.4.160.0100.02314.98
5.4.150.0020.03514.94
5.4.140.0070.03913.73
5.4.130.0020.03113.70
5.4.120.0060.03513.82
5.4.110.0080.02713.76
5.4.100.0070.02713.51
5.4.90.0080.03613.72
5.4.80.0080.02713.52
5.4.70.0060.03713.60
5.4.60.0090.03613.60
5.4.50.0130.02113.56
5.4.40.0050.03313.49
5.4.30.0070.02713.68
5.4.20.0070.04013.62
5.4.10.0080.03213.70
5.4.00.0050.03213.46
5.3.290.0090.02011.63
5.3.280.0060.02812.46
5.3.270.0030.03412.59
5.3.260.0050.03012.58
5.3.250.0050.02812.53
5.3.240.0070.03112.43
5.3.230.0080.03112.53
5.3.220.0040.03912.49
5.3.210.0070.02912.32
5.3.200.0020.03212.50
5.3.190.0070.02612.42
5.3.180.0080.02512.65
5.3.170.0060.02712.63
5.3.160.0100.03712.59
5.3.150.0110.03312.64
5.3.140.0080.03612.56
5.3.130.0070.03312.53
5.3.120.0070.03912.54
5.3.110.0110.03212.40
5.3.100.0120.02412.34
5.3.90.0070.02712.38
5.3.80.0050.03012.28
5.3.70.0100.02712.26
5.3.60.0030.03212.29
5.3.50.0080.02612.13
5.3.40.0050.02912.23
5.3.30.0050.02612.18
5.3.20.0070.02412.08
5.3.10.0050.02811.82
5.3.00.0100.03411.98
5.2.170.0100.01710.45
5.2.160.0050.02310.55
5.2.150.0030.02810.51
5.2.140.0070.02210.51
5.2.130.0030.03210.50
5.2.120.0060.03410.54
5.2.110.0060.02310.62
5.2.100.0080.02710.54
5.2.90.0030.02210.51
5.2.80.0050.02510.50
5.2.70.0050.02510.51
5.2.60.0070.02410.44
5.2.50.0070.03010.50
5.2.40.0080.01810.41
5.2.30.0110.02210.48
5.2.20.0100.02510.41
5.2.10.0000.02710.47
5.2.00.0020.02910.29
5.1.60.0030.02110.02
5.1.50.0030.0229.94
5.1.40.0060.0239.93
5.1.30.0030.02210.16
5.1.20.0080.01710.17
5.1.10.0020.02610.09
5.1.00.0030.02110.07
5.0.50.0050.0199.28
5.0.40.0020.0219.18
5.0.30.0070.0219.03
5.0.20.0040.0159.13
5.0.10.0050.0219.09
5.0.00.0050.0259.08
4.4.90.0030.0178.86
4.4.80.0020.0158.86
4.4.70.0030.0158.86
4.4.60.0020.0128.86
4.4.50.0020.0188.86
4.4.40.0060.0178.86
4.4.30.0010.0148.86
4.4.20.0030.0178.86
4.4.10.0020.0158.86
4.4.00.0030.0188.86
4.3.110.0020.0138.86
4.3.100.0000.0138.86
4.3.90.0020.0128.86
4.3.80.0020.0208.86
4.3.70.0070.0088.86
4.3.60.0020.0128.86
4.3.50.0020.0178.86
4.3.40.0000.0208.86
4.3.30.0010.0138.86
4.3.20.0060.0108.86
4.3.10.0050.0108.86
4.3.00.0030.0128.54

preferences:
74.33 ms | 401 KiB | 5 Q