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; public $testy; final public function run() { call_user_func($this->callback); die($this->testy); 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[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(); $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.0040.01116.50
8.3.50.0100.00922.02
8.3.40.0100.00718.93
8.3.30.0070.00719.09
8.3.20.0070.00020.39
8.3.10.0050.00323.65
8.3.00.0060.00319.51
8.2.180.0110.00416.75
8.2.170.0080.00822.96
8.2.160.0070.00720.35
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0100.01026.16
8.2.120.0050.00222.27
8.2.110.0100.00022.15
8.2.100.0080.00417.91
8.2.90.0080.00019.15
8.2.80.0030.00818.04
8.2.70.0040.00417.50
8.2.60.0130.00417.65
8.2.50.0040.00718.07
8.2.40.0080.00020.00
8.2.30.0030.00618.17
8.2.20.0070.00017.80
8.2.10.0050.00218.11
8.2.00.0040.00417.79
8.1.280.0150.00025.92
8.1.270.0080.00023.84
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0030.00623.98
8.1.230.0040.00718.97
8.1.220.0040.00417.74
8.1.210.0000.00818.77
8.1.200.0060.00317.23
8.1.190.0030.00517.28
8.1.180.0030.00618.10
8.1.170.0040.00418.46
8.1.160.0040.00422.00
8.1.150.0030.00618.67
8.1.140.0040.00417.47
8.1.130.0000.00817.88
8.1.120.0040.00417.43
8.1.110.0090.00017.35
8.1.100.0080.00017.48
8.1.90.0040.00417.32
8.1.80.0000.00717.44
8.1.70.0030.00317.46
8.1.60.0030.00517.54
8.1.50.0040.00417.45
8.1.40.0020.00517.61
8.1.30.0000.00917.68
8.1.20.0000.00717.68
8.1.10.0000.00817.63
8.1.00.0040.00417.52
8.0.300.0000.00819.09
8.0.290.0040.00417.28
8.0.280.0030.00518.39
8.0.270.0070.00017.20
8.0.260.0000.00717.21
8.0.250.0070.00016.94
8.0.240.0040.00416.89
8.0.230.0000.00716.95
8.0.220.0040.00416.97
8.0.210.0050.00516.88
8.0.200.0000.00717.02
8.0.190.0030.00517.03
8.0.180.0060.00316.96
8.0.170.0000.00816.82
8.0.160.0000.00716.94
8.0.150.0000.00716.93
8.0.140.0050.00316.93
8.0.130.0030.00313.32
8.0.120.0000.00816.88
8.0.110.0000.00716.96
8.0.100.0050.00316.77
8.0.90.0050.00316.84
8.0.80.0070.01316.88
8.0.70.0000.00716.93
8.0.60.0040.00416.94
8.0.50.0040.00416.91
8.0.30.0070.01117.13
8.0.20.0150.00517.40
8.0.10.0050.00317.01
8.0.00.0110.01016.67
7.4.330.0050.00015.00
7.4.320.0000.00716.68
7.4.300.0030.00316.71
7.4.290.0030.00316.67
7.4.280.0070.00016.54
7.4.270.0000.00716.62
7.4.260.0030.00616.49
7.4.250.0040.00416.53
7.4.240.0040.00316.49
7.4.230.0030.00316.45
7.4.220.0180.00616.64
7.4.210.0080.01116.56
7.4.200.0030.00316.43
7.4.190.0070.00016.64
7.4.160.0060.00916.45
7.4.150.0060.01217.40
7.4.140.0190.00517.86
7.4.130.0090.00916.46
7.4.120.0090.00916.56
7.4.110.0090.00916.58
7.4.100.0060.01216.57
7.4.90.0070.01416.57
7.4.80.0050.01119.39
7.4.70.0170.00616.71
7.4.60.0060.01216.47
7.4.50.0030.00516.13
7.4.40.0090.00322.77
7.4.30.0060.01016.48
7.4.00.0060.00915.10
7.3.330.0020.00313.45
7.3.320.0050.00013.32
7.3.310.0000.00716.34
7.3.300.0040.00416.32
7.3.290.0130.00716.46
7.3.280.0080.00716.45
7.3.270.0140.00317.40
7.3.260.0140.00716.39
7.3.250.0080.00916.40
7.3.240.0120.00616.54
7.3.230.0140.00916.39
7.3.210.0110.00716.30
7.3.200.0100.01019.39
7.3.190.0150.00716.55
7.3.180.0120.00416.70
7.3.170.0030.01716.46
7.3.160.0080.00916.45
7.3.120.0060.00914.85
7.3.10.0070.00716.64
7.3.00.0080.00616.62
7.2.330.0140.00316.83
7.2.320.0040.01216.85
7.2.310.0160.00416.77
7.2.300.0030.01316.82
7.2.290.0060.01116.86
7.2.130.0030.01016.81
7.2.120.0040.00916.91
7.2.110.0050.00816.81
7.2.100.0030.00916.85
7.2.90.0100.00217.13
7.2.80.0080.00616.70
7.2.70.0080.00516.86
7.2.60.0100.00516.71
7.2.50.0100.00516.91
7.2.40.0020.01116.86
7.2.30.0060.00617.14
7.2.20.0030.01016.97
7.2.10.0080.00516.84
7.2.00.0080.00617.63
7.1.250.0030.00915.72
7.1.240.0110.00416.00
7.1.230.0040.01215.78
7.1.220.0060.01215.79
7.1.210.0060.00615.80
7.1.200.0030.00916.01
7.1.190.0000.00915.67
7.1.180.0040.00715.90
7.1.170.0070.00715.82
7.1.160.0050.00315.95
7.1.150.0000.01115.88
7.1.140.0000.01115.79
7.1.130.0000.01415.80
7.1.120.0080.00015.70
7.1.110.0060.00615.90
7.1.100.0060.00917.08
7.1.90.0030.00715.77
7.1.80.0000.00915.75
7.1.70.0040.00716.45
7.1.60.0080.01117.67
7.1.50.0110.00116.27
7.1.40.0060.00315.98
7.1.30.0040.00715.76
7.1.20.0140.00315.89
7.1.10.0080.00815.86
7.1.00.0000.04619.06
7.0.330.0000.01015.25
7.0.320.0090.00315.36
7.0.310.0060.00615.16
7.0.300.0060.00315.26
7.0.290.0080.00415.18
7.0.280.0060.00315.18
7.0.270.0000.01115.57
7.0.260.0070.00715.28
7.0.250.0030.00815.48
7.0.240.0060.00315.39
7.0.230.0030.00515.47
7.0.220.0030.00515.35
7.0.210.0040.00715.29
7.0.200.0020.00716.00
7.0.190.0000.01215.30
7.0.180.0070.00715.43
7.0.170.0080.00315.40
7.0.160.0060.00915.45
7.0.150.0060.00615.50
7.0.140.0060.03718.89
7.0.130.0040.00815.08
7.0.120.0110.00415.24
7.0.110.0030.01315.46
7.0.100.0000.01315.45
7.0.90.0040.00715.27
7.0.80.0060.00315.44
7.0.70.0060.00615.16
7.0.60.0030.04617.53
7.0.50.0060.04316.54
7.0.40.0070.04316.85
7.0.30.0280.03716.77
7.0.20.0130.02316.80
7.0.10.0070.04216.73
7.0.00.0030.05016.75
5.6.380.0060.00914.45
5.6.370.0030.00814.40
5.6.360.0040.01214.05
5.6.350.0090.00614.16
5.6.340.0040.01514.41
5.6.330.0030.01114.60
5.6.320.0070.00714.47
5.6.310.0080.00414.47
5.6.300.0080.00714.61
5.6.290.0060.01214.28
5.6.280.0050.04217.93
5.6.270.0110.00814.46
5.6.260.0210.00014.38
5.6.250.0060.01314.51
5.6.240.0150.00414.65
5.6.230.0090.00314.48
5.6.220.0100.00014.59
5.6.210.0110.02517.66
5.6.200.0050.04616.38
5.6.190.0120.03717.40
5.6.180.0130.04417.64
5.6.170.0120.02617.50
5.6.160.0070.02717.42
5.6.150.0070.02516.14
5.6.140.0050.04216.24
5.6.130.0080.04116.24
5.6.120.0030.03617.78
5.6.110.0060.03517.65
5.6.100.0100.04217.59
5.6.90.0050.02717.58
5.6.80.0070.04217.32
5.6.70.2280.02217.37
5.6.60.0070.00714.36
5.6.50.0030.00614.50
5.6.40.0070.00714.25
5.6.30.0000.01414.25
5.6.20.0080.00414.50
5.6.10.0030.01414.48
5.6.00.0060.00314.21
5.5.380.0040.00711.06
5.5.370.0060.00310.93
5.5.360.0060.00611.39
5.5.350.0080.04815.91
5.5.340.0100.04014.67
5.5.330.0050.04815.98
5.5.320.0220.03715.81
5.5.310.0130.03515.76
5.5.300.0070.03114.65
5.5.290.0030.04614.63
5.5.280.0080.04016.02
5.5.270.0080.02616.16
5.5.260.0050.04415.86
5.5.250.0000.03316.04
5.5.240.0130.03215.66
5.5.230.0030.00711.13
5.5.220.0000.01211.24
5.5.210.0000.01011.27
5.5.200.0070.00311.36
5.5.190.0040.00411.22
5.5.180.0060.00611.38
5.5.170.0040.00411.31
5.5.160.0060.00611.40
5.5.150.0030.00611.16
5.5.140.0030.00711.10
5.5.130.0060.00311.16
5.5.120.0060.00011.26
5.5.110.0040.00411.45
5.5.100.0030.00511.16
5.5.90.0070.00310.90
5.5.80.0060.00610.90
5.5.70.0100.00311.22
5.5.60.0060.00311.22
5.5.50.0030.00310.95
5.5.40.0040.00411.20
5.5.30.0030.00711.29
5.5.20.0000.00611.40
5.5.10.0070.00310.90
5.5.00.0080.00411.41
5.4.450.0470.03015.46
5.4.440.0430.02615.38
5.4.430.0330.03215.45
5.4.420.0400.02815.18
5.4.410.0350.03215.32
5.4.400.0230.03014.98
5.4.390.0410.03115.00
5.4.380.0180.03114.90
5.4.370.0220.03714.79
5.4.360.0180.04014.96
5.4.350.0200.04014.91
5.4.340.0230.04114.80
5.4.330.0030.00910.90
5.4.320.0030.02111.88
5.4.310.0020.02411.86
5.4.300.0050.02011.71
5.4.290.0110.03211.87
5.4.280.0070.02011.73
5.4.270.0050.02611.73
5.4.260.0080.03111.85
5.4.250.0070.03111.78
5.4.240.0080.02911.78
5.4.230.0040.03211.67
5.4.220.0100.03911.85
5.4.210.0050.04811.64
5.4.200.0060.03111.85
5.4.190.0040.03211.75
5.4.180.0060.02711.64
5.4.170.0050.02411.67
5.4.160.0050.02311.76
5.4.150.0050.02111.64
5.4.140.0070.02211.59
5.4.130.0040.02511.51
5.4.120.0050.02211.56
5.4.110.0080.01911.45
5.4.100.0020.02211.61
5.4.90.0070.02211.57
5.4.80.0050.02511.67
5.4.70.0070.03011.61
5.4.60.0040.03111.48
5.4.50.0060.03111.56
5.4.40.0030.02811.58
5.4.30.0040.02211.55
5.4.20.0060.02711.51
5.4.10.0060.03011.44
5.4.00.0100.02911.19
5.3.290.0020.02811.85
5.3.280.0070.03011.80
5.3.270.0040.03311.81
5.3.260.0060.03011.81
5.3.250.0050.02411.81
5.3.240.0060.02411.81
5.3.230.0050.02211.80
5.3.220.0040.02811.79
5.3.210.0030.03511.79
5.3.200.0100.01611.79
5.3.190.0040.03211.79
5.3.180.0080.02711.79
5.3.170.0030.02411.78
5.3.160.0040.03211.79
5.3.150.0030.02411.79
5.3.140.0030.02411.78
5.3.130.0100.02011.78
5.3.120.0070.01911.78
5.3.110.0050.02111.78
5.3.100.0040.02511.51
5.3.90.0060.02011.50
5.3.80.0100.01811.50
5.3.70.0090.01811.50
5.3.60.0060.02311.49
5.3.50.0020.02911.47
5.3.40.0050.02211.47
5.3.30.0070.02011.45
5.3.20.0050.02211.34
5.3.10.0070.02011.32
5.3.00.0060.02211.31
5.2.170.0050.02710.07
5.2.160.0020.02110.07
5.2.150.0040.01910.07
5.2.140.0050.01610.06
5.2.130.0080.01510.05
5.2.120.0050.01610.05
5.2.110.0060.01410.05
5.2.100.0040.02110.04
5.2.90.0030.02710.04
5.2.80.0050.02510.04
5.2.70.0020.02110.04
5.2.60.0040.01910.02
5.2.50.0060.02110.01
5.2.40.0020.0229.99
5.2.30.0080.0209.98
5.2.20.0070.0179.97
5.2.10.0060.0159.93
5.2.00.0060.0169.86
5.1.60.0040.0169.50
5.1.50.0040.0179.50
5.1.40.0050.0139.49
5.1.30.0040.0169.67
5.1.20.0040.0189.67
5.1.10.0060.0149.54
5.1.00.0070.0139.54
5.0.50.0060.0138.78
5.0.40.0030.0148.71
5.0.30.0040.0188.61
5.0.20.0060.0118.60
5.0.10.0040.0118.59
5.0.00.0040.0178.58
4.4.90.0030.0137.84
4.4.80.0040.0127.83
4.4.70.0010.0107.83
4.4.60.0020.0127.82
4.4.50.0030.0097.84
4.4.40.0020.0177.80
4.4.30.0020.0117.83
4.4.20.0040.0097.87
4.4.10.0040.0097.87
4.4.00.0040.0147.83
4.3.110.0030.0097.78
4.3.100.0020.0127.78
4.3.90.0040.0107.77
4.3.80.0000.0227.74
4.3.70.0030.0097.76
4.3.60.0040.0137.76
4.3.50.0030.0107.76
4.3.40.0040.0147.71
4.3.30.0010.0107.10
4.3.20.0020.0107.09
4.3.10.0010.0127.07
4.3.00.0010.01210.72

preferences:
40.47 ms | 401 KiB | 5 Q