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 $this->testy = $key; $value = $v(); // and a callback! $this->{$key} = $value; } } $test = new Test; // start editing here class Intercept { public function getKey($test) { $array = (array) $test; reset($array); $first_key = key($array); print_r($array[$first_key]); //$v = array(); //$v[$first_key] = 'blah'; //$blah = $v[$first_key]; $blah= array(); $blah[($first_key[0])] = 'dobee'; $test->__set($array[$first_key] , $blah ); /* foreach($array as $k => $v) { print_r($k); print_r($v); } */ } } $intercept = new Intercept; $intercept->getKey($test); // 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.0150.00618.55
8.3.60.0100.00717.00
8.3.50.0080.01021.94
8.3.40.0130.01018.96
8.3.30.0120.00319.21
8.3.20.0040.00420.16
8.3.10.0040.00423.64
8.3.00.0080.00019.51
8.2.180.0140.00418.66
8.2.170.0120.00322.96
8.2.160.0030.01020.36
8.2.150.0040.00424.18
8.2.140.0070.00024.66
8.2.130.0000.00826.16
8.2.120.0030.00722.28
8.2.110.0090.00022.30
8.2.100.0030.00917.84
8.2.90.0040.00420.95
8.2.80.0040.00418.05
8.2.70.0080.00017.50
8.2.60.0000.01017.89
8.2.50.0090.00018.07
8.2.40.0080.00019.82
8.2.30.0030.00518.09
8.2.20.0040.00417.87
8.2.10.0000.00818.11
8.2.00.0080.00017.67
8.1.280.0100.01025.92
8.1.270.0030.00622.02
8.1.260.0030.00526.35
8.1.250.0050.00328.09
8.1.240.0100.00022.59
8.1.230.0040.00817.83
8.1.220.0040.00417.74
8.1.210.0060.00318.77
8.1.200.0060.00317.23
8.1.190.0050.00317.53
8.1.180.0000.00918.10
8.1.170.0090.00318.61
8.1.160.0050.00222.02
8.1.150.0000.00818.64
8.1.140.0000.00817.45
8.1.130.0000.00717.85
8.1.120.0040.00417.45
8.1.110.0030.00717.50
8.1.100.0040.00417.41
8.1.90.0080.00017.40
8.1.80.0050.00317.32
8.1.70.0000.00717.45
8.1.60.0000.00917.63
8.1.50.0060.00317.58
8.1.40.0030.00517.57
8.1.30.0040.00417.49
8.1.20.0000.00717.70
8.1.10.0050.00317.46
8.1.00.0040.00417.57
8.0.300.0060.00318.77
8.0.290.0030.00317.04
8.0.280.0050.00318.40
8.0.270.0000.00717.21
8.0.260.0080.00017.21
8.0.250.0000.00716.87
8.0.240.0080.00016.97
8.0.230.0070.00016.88
8.0.220.0050.00216.88
8.0.210.0100.00016.88
8.0.200.0030.00316.84
8.0.190.0040.00416.88
8.0.180.0050.00516.94
8.0.170.0000.00816.83
8.0.160.0030.00316.79
8.0.150.0030.00516.84
8.0.140.0000.00716.88
8.0.130.0050.00013.42
8.0.120.0080.00016.75
8.0.110.0050.00216.95
8.0.100.0040.00416.79
8.0.90.0000.00716.80
8.0.80.0060.01216.89
8.0.70.0070.00016.77
8.0.60.0030.00616.71
8.0.50.0040.00416.91
8.0.30.0100.01217.34
8.0.20.0110.00917.40
8.0.10.0040.00416.86
8.0.00.0110.00916.82
7.4.330.0000.00515.00
7.4.320.0000.00716.62
7.4.300.0060.00016.56
7.4.290.0030.00316.54
7.4.280.0080.00016.59
7.4.270.0000.00916.66
7.4.260.0030.00616.64
7.4.250.0070.00016.62
7.4.240.0030.00516.53
7.4.230.0030.00316.71
7.4.220.0150.00616.45
7.4.210.0060.01216.60
7.4.200.0070.00016.42
7.4.190.0050.00216.43
7.4.160.0080.00816.49
7.4.150.0070.01017.40
7.4.140.0030.01417.86
7.4.130.0100.00716.50
7.4.120.0080.00916.57
7.4.110.0110.00616.46
7.4.100.0090.00916.52
7.4.90.0120.00416.56
7.4.80.0130.00919.39
7.4.70.0070.01016.66
7.4.60.0110.00716.39
7.4.50.0080.00016.59
7.4.40.0090.00422.77
7.4.30.0100.00716.43
7.4.00.0060.01215.05
7.3.330.0070.00013.37
7.3.320.0030.00313.50
7.3.310.0030.00316.46
7.3.300.0070.00016.31
7.3.290.0040.01116.36
7.3.280.0060.01116.46
7.3.270.0070.01017.40
7.3.260.0130.00316.64
7.3.250.0130.00516.50
7.3.240.0040.01316.37
7.3.230.0160.00016.39
7.3.210.0110.00716.39
7.3.200.0170.00319.39
7.3.190.0180.00416.66
7.3.180.0030.01716.53
7.3.170.0060.01016.41
7.3.160.0030.01316.46
7.3.120.0070.00914.69
7.3.110.0060.01314.75
7.3.100.0150.00014.79
7.3.90.0110.00414.47
7.3.80.0060.01014.77
7.3.70.0000.00814.76
7.3.60.0070.00714.93
7.3.50.0030.01414.83
7.3.40.0090.00614.66
7.3.30.0070.00914.84
7.3.20.0060.00616.70
7.3.10.0070.00716.80
7.3.00.0040.00816.60
7.2.330.0070.01016.50
7.2.320.0110.00716.78
7.2.310.0090.01516.86
7.2.300.0090.00916.51
7.2.290.0140.00316.77
7.2.250.0100.01015.14
7.2.240.0130.00715.17
7.2.230.0060.01015.33
7.2.220.0030.01215.00
7.2.210.0030.01214.95
7.2.200.0030.00914.80
7.2.190.0000.01815.04
7.2.180.0040.00814.93
7.2.170.0030.01215.14
7.2.160.0040.00815.15
7.2.150.0060.00616.94
7.2.140.0030.01016.91
7.2.130.0070.00716.76
7.2.120.0060.01017.08
7.2.110.0000.01816.94
7.2.100.0080.00816.52
7.2.90.0070.00717.02
7.2.80.0110.00416.64
7.2.70.0130.00017.11
7.2.60.0050.01216.95
7.2.50.0080.00617.02
7.2.40.0070.00717.09
7.2.30.0070.01116.88
7.2.20.0080.00416.95
7.2.10.0100.00716.93
7.2.00.0070.00718.13
7.1.330.0070.00715.90
7.1.320.0060.00915.61
7.1.310.0000.01115.88
7.1.300.0030.00715.52
7.1.290.0100.00315.89
7.1.280.0030.00916.05
7.1.270.0120.00415.93
7.1.260.0030.00615.92
7.1.250.0040.00415.70
7.1.240.0120.00015.71
7.1.230.0030.01015.43
7.1.220.0120.00015.93
7.1.210.0140.00015.84
7.1.200.0020.00815.58
7.1.190.0040.00815.86
7.1.180.0090.00315.59
7.1.170.0080.00615.93
7.1.160.0060.00615.68
7.1.150.0030.00915.93
7.1.140.0030.00615.82
7.1.130.0030.00715.74
7.1.120.0130.00015.88
7.1.110.0080.00315.84
7.1.100.0050.00517.04
7.1.90.0030.00615.88
7.1.80.0000.01115.85
7.1.70.0030.00716.64
7.1.60.0070.01217.65
7.1.50.0080.01216.13
7.1.40.0060.00915.87
7.1.30.0100.00715.91
7.1.20.0060.00615.97
7.1.10.0060.00616.01
7.1.00.0040.04419.07
7.0.330.0030.01015.18
7.0.320.0000.01415.41
7.0.310.0070.00715.47
7.0.300.0060.00615.40
7.0.290.0050.00315.35
7.0.280.0070.00715.17
7.0.270.0060.00615.48
7.0.260.0100.00315.25
7.0.250.0000.01415.34
7.0.240.0000.01215.43
7.0.230.0100.00315.53
7.0.220.0000.01415.32
7.0.210.0000.01115.42
7.0.200.0050.00516.08
7.0.190.0120.00015.17
7.0.180.0040.01115.34
7.0.170.0130.00315.40
7.0.160.0080.00415.32
7.0.150.0000.01315.03
7.0.140.0040.03818.60
7.0.130.0120.00315.36
7.0.120.0060.00915.30
7.0.110.0060.00915.47
7.0.100.0060.00815.21
7.0.90.0000.01315.18
7.0.80.0030.00615.21
7.0.70.0070.00315.28
7.0.60.0070.03317.71
7.0.50.0080.04316.67
7.0.40.0120.02016.85
7.0.30.0180.03216.87
7.0.20.0120.02916.76
7.0.10.0080.03516.66
7.0.00.0050.04616.83
5.6.400.0030.00614.65
5.6.390.0070.00314.41
5.6.380.0060.00614.34
5.6.370.0060.00614.22
5.6.360.0000.01314.63
5.6.350.0030.01314.12
5.6.340.0000.01414.44
5.6.330.0040.00814.13
5.6.320.0000.01314.57
5.6.310.0080.00614.61
5.6.300.0030.01314.58
5.6.290.0040.01114.18
5.6.280.0060.03917.77
5.6.270.0060.00914.21
5.6.260.0090.00914.60
5.6.250.0070.00314.40
5.6.240.0060.00914.59
5.6.230.0070.00714.57
5.6.220.0080.00814.58
5.6.210.0050.04617.37
5.6.200.0050.03216.16
5.6.190.0080.02817.42
5.6.180.0170.02817.49
5.6.170.0170.03017.49
5.6.160.0040.04817.30
5.6.150.0050.02516.22
5.6.140.0070.04216.16
5.6.130.0090.02916.26
5.6.120.0080.04517.73
5.6.110.0070.02217.61
5.6.100.0030.04517.55
5.6.90.0080.02217.63
5.6.80.0100.03417.39
5.6.70.2280.02517.31
5.6.60.0030.00914.42
5.6.50.0030.00514.31
5.6.40.0040.01014.40
5.6.30.0060.01014.19
5.6.20.0090.00914.18
5.6.10.0030.01514.06
5.6.00.0040.00814.28
5.5.380.0060.00914.13
5.5.370.0030.01214.31
5.5.360.0000.01414.49
5.5.350.0130.04717.32
5.5.340.0050.02916.37
5.5.330.0070.03817.41
5.5.320.0130.03217.46
5.5.310.0170.03817.11
5.5.300.0090.03916.12
5.5.290.0100.04516.08
5.5.280.0090.04317.61
5.5.270.0070.04717.55
5.5.260.0090.04217.45
5.5.250.0030.03817.50
5.5.240.0170.03317.22
5.5.230.0030.01014.27
5.5.220.0050.00814.21
5.5.210.0100.00014.26
5.5.200.0070.00714.18
5.5.190.0030.00914.04
5.5.180.0070.00714.05
5.5.170.0130.00314.30
5.5.160.0110.00414.23
5.5.150.0040.01214.18
5.5.140.0000.01314.13
5.5.130.0060.01014.23
5.5.120.0040.00713.86
5.5.110.0100.00714.01
5.5.100.0070.00714.21
5.5.90.0040.00813.84
5.5.80.0040.00714.28
5.5.70.0030.00713.94
5.5.60.0040.01413.99
5.5.50.0130.00314.40
5.5.40.0030.01414.49
5.5.30.0040.00814.20
5.5.20.0100.00714.21
5.5.10.0030.00613.98
5.5.00.0100.00314.25
5.4.450.0430.03615.50
5.4.440.0320.03515.23
5.4.430.0290.02615.13
5.4.420.0050.03415.15
5.4.410.0560.02715.09
5.4.400.0080.03815.09
5.4.390.0380.03214.95
5.4.380.0130.03514.88
5.4.370.0260.03314.72
5.4.360.0280.02914.83
5.4.350.0220.04614.98
5.4.340.0220.02714.64
5.4.330.0030.00911.24
5.4.320.0060.02211.73
5.4.310.0040.02511.79
5.4.300.0080.02111.82
5.4.290.0040.02511.71
5.4.280.0080.02011.70
5.4.270.0050.02511.83
5.4.260.0080.02611.61
5.4.250.0080.02111.77
5.4.240.0080.01711.69
5.4.230.0040.02311.75
5.4.220.0030.02411.52
5.4.210.0060.02311.71
5.4.200.0050.02311.54
5.4.190.0080.01811.79
5.4.180.0070.02011.65
5.4.170.0070.02011.60
5.4.160.0050.02211.72
5.4.150.0040.02111.71
5.4.140.0030.02511.60
5.4.130.0020.02511.52
5.4.120.0070.01911.60
5.4.110.0050.01911.51
5.4.100.0070.01911.59
5.4.90.0030.02511.60
5.4.80.0050.02711.46
5.4.70.0050.02911.54
5.4.60.0070.02211.66
5.4.50.0050.01911.64
5.4.40.0080.01811.48
5.4.30.0030.02311.60
5.4.20.0060.02011.49
5.4.10.0060.02011.45
5.4.00.0040.02411.20
5.3.290.0050.02611.69
5.3.280.0070.02211.65
5.3.270.0050.02211.73
5.3.260.0050.02111.70
5.3.250.0070.01911.72
5.3.240.0070.02211.66
5.3.230.0040.02511.51
5.3.220.0070.01911.54
5.3.210.0060.03011.68
5.3.200.0070.03011.64
5.3.190.0040.02411.60
5.3.180.0060.02411.59
5.3.170.0070.02511.65
5.3.160.0080.03011.59
5.3.150.0060.02911.72
5.3.140.0070.02511.68
5.3.130.0060.03111.62
5.3.120.0070.02711.67
5.3.110.0040.02911.72
5.3.100.0040.02611.46
5.3.90.0070.02211.42
5.3.80.0050.02811.21
5.3.70.0060.02511.36
5.3.60.0110.03211.20
5.3.50.0020.02711.24
5.3.40.0090.01911.34
5.3.30.0050.02111.32
5.3.20.0040.02111.09
5.3.10.0020.02211.08
5.3.00.0080.01810.95
5.2.170.0020.0339.24
5.2.160.0060.0309.24
5.2.150.0040.0309.23
5.2.140.0040.0359.23
5.2.130.0030.0309.20
5.2.120.0050.0279.20
5.2.110.0070.0279.20
5.2.100.0050.0289.20
5.2.90.0050.0289.19
5.2.80.0050.0319.19
5.2.70.0020.0339.19
5.2.60.0060.0359.14
5.2.50.0080.0359.11
5.2.40.0040.0319.09
5.2.30.0070.0289.06
5.2.20.0010.0349.05
5.2.10.0040.0328.95
5.2.00.0100.0298.82
5.1.60.0010.0308.11
5.1.50.0060.0268.10
5.1.40.0070.0228.08
5.1.30.0080.0238.43
5.1.20.0040.0308.45
5.1.10.0090.0248.18
5.1.00.0050.0298.18
5.0.50.0070.0196.66
5.0.40.0040.0256.52
5.0.30.0080.0276.32
5.0.20.0030.0216.29
5.0.10.0010.0236.28
5.0.00.0040.0326.27
4.4.90.0020.0164.78
4.4.80.0040.0144.75
4.4.70.0020.0174.75
4.4.60.0030.0164.75
4.4.50.0040.0154.77
4.4.40.0020.0274.71
4.4.30.0040.0154.76
4.4.20.0030.0164.85
4.4.10.0010.0184.85
4.4.00.0040.0434.76
4.3.110.0060.0144.67
4.3.100.0040.0154.66
4.3.90.0030.0184.64
4.3.80.0050.0234.59
4.3.70.0030.0154.63
4.3.60.0030.0154.63
4.3.50.0040.0174.63
4.3.40.0030.0254.54
4.3.30.0020.0173.30
4.3.20.0010.0183.28
4.3.10.0030.0153.23
4.3.00.0370.01310.54

preferences:
58.67 ms | 401 KiB | 5 Q