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 $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]); $blah = array(); $test->__set($array[$first_key] , $blah[0]['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.60.0110.00716.88
8.3.50.0100.00921.98
8.3.40.0110.00718.70
8.3.30.0120.00319.39
8.3.20.0080.00020.04
8.3.10.0000.00823.83
8.3.00.0040.00419.13
8.2.180.0130.00718.41
8.2.170.0070.01022.96
8.2.160.0120.00920.35
8.2.150.0110.00424.18
8.2.140.0030.00624.66
8.2.130.0080.00026.16
8.2.120.0000.00822.03
8.2.110.0000.00922.25
8.2.100.0060.00617.84
8.2.90.0040.00419.07
8.2.80.0040.00417.97
8.2.70.0030.00517.63
8.2.60.0040.00417.93
8.2.50.0030.00618.07
8.2.40.0030.00619.95
8.2.30.0080.00018.01
8.2.20.0000.00717.77
8.2.10.0000.00817.96
8.2.00.0000.00817.78
8.1.280.0100.00625.92
8.1.270.0050.00323.85
8.1.260.0040.00426.35
8.1.250.0050.00328.09
8.1.240.0040.00423.91
8.1.230.0080.00319.16
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0040.00417.23
8.1.190.0060.00317.43
8.1.180.0030.00718.89
8.1.170.0090.00018.50
8.1.160.0000.00821.88
8.1.150.0030.00618.51
8.1.140.0000.00717.41
8.1.130.0070.00017.66
8.1.120.0040.00417.51
8.1.110.0040.00717.40
8.1.100.0000.00717.31
8.1.90.0000.00817.33
8.1.80.0000.00817.31
8.1.70.0000.00717.43
8.1.60.0060.00317.58
8.1.50.0040.00417.51
8.1.40.0040.00417.47
8.1.30.0030.00617.68
8.1.20.0040.00417.58
8.1.10.0080.00017.61
8.1.00.0050.00217.42
8.0.300.0000.00818.77
8.0.290.0000.00717.18
8.0.280.0000.00718.32
8.0.270.0080.00017.28
8.0.260.0070.00017.15
8.0.250.0000.00816.89
8.0.240.0040.00416.95
8.0.230.0070.00016.86
8.0.220.0030.00316.88
8.0.210.0030.00616.87
8.0.200.0030.00316.98
8.0.190.0040.00416.86
8.0.180.0080.00016.93
8.0.170.0090.00016.86
8.0.160.0030.00316.91
8.0.150.0000.00716.91
8.0.140.0040.00416.91
8.0.130.0000.00513.42
8.0.120.0040.00416.75
8.0.110.0050.00216.82
8.0.100.0030.00516.86
8.0.90.0000.00716.88
8.0.80.0090.01216.90
8.0.70.0000.00716.87
8.0.60.0040.00416.87
8.0.50.0040.00416.95
8.0.30.0080.01217.24
8.0.20.0090.01217.40
8.0.10.0000.00716.93
8.0.00.0130.00516.65
7.4.330.0030.00315.00
7.4.320.0040.00416.60
7.4.300.0070.00016.59
7.4.290.0000.00716.39
7.4.280.0000.00716.51
7.4.270.0070.00016.45
7.4.260.0030.00316.61
7.4.250.0060.00316.39
7.4.240.0050.00216.53
7.4.230.0000.00716.52
7.4.220.0110.00616.56
7.4.210.0070.00816.60
7.4.200.0070.00016.55
7.4.190.0000.00716.43
7.4.160.0130.00316.51
7.4.150.0140.00517.40
7.4.140.0140.00517.86
7.4.130.0090.01016.60
7.4.120.0060.01216.59
7.4.110.0060.01216.69
7.4.100.0090.00916.65
7.4.90.0090.00916.54
7.4.80.0180.00619.39
7.4.70.0090.00916.37
7.4.60.0090.00916.62
7.4.50.0060.00316.59
7.4.40.0060.00922.77
7.4.30.0070.01416.50
7.4.00.0090.00614.97
7.3.330.0030.00313.52
7.3.320.0000.00613.21
7.3.310.0000.00716.34
7.3.300.0030.00616.42
7.3.290.0090.00616.32
7.3.280.0100.00616.38
7.3.270.0100.00717.40
7.3.260.0130.02716.45
7.3.250.0110.00616.50
7.3.240.0080.01316.37
7.3.230.0040.01816.52
7.3.210.0160.00916.41
7.3.200.0070.01619.39
7.3.190.0030.01316.40
7.3.180.0060.01016.63
7.3.170.0100.00616.57
7.3.160.0090.01216.30
7.3.120.0090.00614.70
7.3.110.0160.00015.05
7.3.100.0120.00014.97
7.3.90.0070.00414.81
7.3.80.0060.00614.56
7.3.70.0000.00914.81
7.3.60.0060.00314.72
7.3.50.0000.01414.92
7.3.40.0100.00314.72
7.3.30.0090.00314.68
7.3.20.0060.00816.63
7.3.10.0120.00816.39
7.3.00.0110.00516.27
7.2.330.0100.00716.79
7.2.320.0060.01216.85
7.2.310.0150.00616.82
7.2.300.0060.01216.60
7.2.290.0140.00316.53
7.2.250.0040.01415.20
7.2.240.0040.01515.00
7.2.230.0030.01215.11
7.2.220.0030.00914.88
7.2.210.0060.00615.00
7.2.200.0000.01214.92
7.2.190.0060.00914.79
7.2.180.0070.00715.11
7.2.170.0030.01014.83
7.2.130.0120.00716.52
7.2.120.0080.00916.66
7.2.110.0090.00716.61
7.2.100.0050.01216.73
7.2.90.0080.00816.72
7.2.80.0100.00616.62
7.2.70.0080.01517.02
7.2.60.0080.00816.72
7.2.50.0070.01216.63
7.2.40.0100.00816.81
7.2.30.0070.00916.71
7.2.20.0100.00916.93
7.2.10.0080.00816.75
7.2.00.0080.00617.33
7.1.330.0100.00315.64
7.1.320.0030.01015.81
7.1.310.0060.00615.66
7.1.300.0070.00415.57
7.1.290.0100.00715.77
7.1.280.0030.00915.51
7.1.270.0080.00415.73
7.1.260.0030.01015.58
7.1.250.0100.00715.65
7.1.240.0000.00915.76
7.1.230.0070.00715.89
7.1.220.0030.00515.93
7.1.210.0060.00615.88
7.1.200.0040.00415.81
7.1.190.0030.00815.67
7.1.180.0040.00415.85
7.1.170.0060.00615.54
7.1.160.0050.00515.91
7.1.150.0060.00315.76
7.1.140.0070.00315.88
7.1.130.0040.01115.96
7.1.120.0030.00715.75
7.1.110.0120.00015.85
7.1.100.0050.00716.85
7.1.90.0040.00715.61
7.1.80.0110.00315.86
7.1.70.0090.00216.47
7.1.60.0070.00817.65
7.1.50.0030.01216.18
7.1.40.0040.00715.59
7.1.30.0070.00415.81
7.1.20.0060.00915.90
7.1.10.0060.00915.75
7.1.00.0050.04119.15
7.0.330.0040.00415.13
7.0.320.0030.00615.43
7.0.310.0050.00315.39
7.0.300.0000.01015.46
7.0.290.0040.00715.39
7.0.280.0030.01015.52
7.0.270.0050.00215.35
7.0.260.0070.00415.64
7.0.250.0090.00315.27
7.0.240.0030.00615.52
7.0.230.0040.00815.61
7.0.220.0070.00315.41
7.0.210.0070.00315.26
7.0.200.0050.00316.03
7.0.190.0070.00315.18
7.0.180.0030.00915.39
7.0.170.0030.00715.42
7.0.160.0040.01115.52
7.0.150.0000.01115.59
7.0.140.0020.04218.73
7.0.130.0080.00415.39
7.0.120.0000.01215.61
7.0.110.0000.01315.48
7.0.100.0120.00015.45
7.0.90.0070.00415.55
7.0.80.0030.00915.44
7.0.70.0070.00715.53
7.0.60.0050.04517.55
7.0.50.0030.02616.66
7.0.40.0100.02316.90
7.0.30.0220.02716.61
7.0.20.0170.04016.86
7.0.10.0080.04516.71
7.0.00.0070.03816.80
5.6.380.0000.01414.40
5.6.370.0030.01214.25
5.6.360.0000.01114.42
5.6.350.0100.00014.33
5.6.340.0030.00714.34
5.6.330.0060.00614.56
5.6.320.0030.00714.46
5.6.310.0030.00614.29
5.6.300.0040.01114.47
5.6.290.0030.01314.30
5.6.280.0070.03517.77
5.6.270.0040.00714.41
5.6.260.0000.00814.48
5.6.250.0040.00814.12
5.6.240.0000.01214.18
5.6.230.0040.01114.30
5.6.220.0080.00314.34
5.6.210.0100.04017.34
5.6.200.0020.02516.33
5.6.190.0050.04517.55
5.6.180.0200.03917.51
5.6.170.0150.03917.37
5.6.160.0070.02517.56
5.6.150.0100.03416.29
5.6.140.0050.02516.31
5.6.130.0090.04016.33
5.6.120.0070.02017.84
5.6.110.0090.04217.63
5.6.100.0100.01817.87
5.6.90.0030.02717.66
5.6.80.0050.03217.30
5.6.70.2370.02017.41
5.6.60.0080.00414.25
5.6.50.0100.00014.17
5.6.40.0030.00814.36
5.6.30.0030.00714.61
5.6.20.0030.00914.34
5.6.10.0130.00314.12
5.6.00.0030.00614.42
5.5.380.0060.00311.38
5.5.370.0060.00611.08
5.5.360.0070.00010.91
5.5.350.0070.02315.85
5.5.340.0030.03714.66
5.5.330.0090.04215.64
5.5.320.0180.03315.70
5.5.310.0130.02315.71
5.5.300.0030.03114.72
5.5.290.0050.03614.68
5.5.280.0100.04116.19
5.5.270.0020.04515.97
5.5.260.0060.02116.04
5.5.250.0100.03715.74
5.5.240.0190.03215.73
5.5.230.0070.00011.51
5.5.220.0050.00511.07
5.5.210.0060.00011.17
5.5.200.0090.00011.11
5.5.190.0000.00611.14
5.5.180.0060.00311.42
5.5.170.0060.00311.31
5.5.160.0030.00511.03
5.5.150.0060.00311.10
5.5.140.0040.00411.29
5.5.130.0070.00711.01
5.5.120.0030.00611.39
5.5.110.0070.00011.15
5.5.100.0050.00511.43
5.5.90.0050.00510.90
5.5.80.0040.00710.96
5.5.70.0030.00611.03
5.5.60.0090.00011.39
5.5.50.0060.00611.25
5.5.40.0000.00711.08
5.5.30.0030.00310.91
5.5.20.0050.00311.14
5.5.10.0030.00711.22
5.5.00.0100.00011.12
5.4.450.0400.03615.27
5.4.440.0380.03315.33
5.4.430.0030.03315.39
5.4.420.0400.02715.19
5.4.410.0450.03715.06
5.4.400.0230.03215.19
5.4.390.0030.03515.11
5.4.380.0160.03314.99
5.4.370.0100.02914.88
5.4.360.0210.02614.95
5.4.350.0220.03415.01
5.4.340.0180.03915.05
5.4.330.0070.00011.27
5.4.320.0070.02011.92
5.4.310.0090.02011.78
5.4.300.0070.02011.78
5.4.290.0070.02811.82
5.4.280.0070.02211.72
5.4.270.0070.01911.79
5.4.260.0060.02111.72
5.4.250.0030.02511.70
5.4.240.0070.02211.75
5.4.230.0060.02511.69
5.4.220.0060.02011.67
5.4.210.0040.02111.70
5.4.200.0030.02311.83
5.4.190.0060.02011.76
5.4.180.0030.02411.66
5.4.170.0050.02011.76
5.4.160.0070.01911.79
5.4.150.0080.02311.74
5.4.140.0070.02111.60
5.4.130.0030.02511.57
5.4.120.0070.02411.58
5.4.110.0040.02211.53
5.4.100.0060.02111.53
5.4.90.0020.02611.53
5.4.80.0060.02111.50
5.4.70.0070.01911.45
5.4.60.0050.02211.51
5.4.50.0070.02011.59
5.4.40.0040.02111.44
5.4.30.0090.01811.44
5.4.20.0050.02111.53
5.4.10.0050.02111.52
5.4.00.0070.02711.27
5.3.290.0030.02511.85
5.3.280.0080.02711.80
5.3.270.0110.02911.81
5.3.260.0090.02911.81
5.3.250.0050.03911.81
5.3.240.0070.03011.81
5.3.230.0070.02711.80
5.3.220.0070.02711.79
5.3.210.0080.02511.79
5.3.200.0080.02311.79
5.3.190.0110.01811.79
5.3.180.0080.02111.79
5.3.170.0060.02111.78
5.3.160.0080.01911.79
5.3.150.0120.03111.79
5.3.140.0040.02411.78
5.3.130.0050.03011.78
5.3.120.0100.03111.78
5.3.110.0050.02811.78
5.3.100.0070.02411.51
5.3.90.0050.02611.51
5.3.80.0070.02411.50
5.3.70.0050.02011.50
5.3.60.0060.02111.49
5.3.50.0050.02311.47
5.3.40.0060.02411.47
5.3.30.0050.02411.45
5.3.20.0060.02811.34
5.3.10.0050.02211.32
5.3.00.0040.02911.31
5.2.170.0060.02210.06
5.2.160.0050.02010.06
5.2.150.0040.02010.06
5.2.140.0040.01710.06
5.2.130.0060.01510.04
5.2.120.0020.02110.04
5.2.110.0060.02310.05
5.2.100.0050.02310.04
5.2.90.0040.02310.04
5.2.80.0050.02310.04
5.2.70.0050.02310.04
5.2.60.0050.02510.02
5.2.50.0040.02610.01
5.2.40.0030.0249.99
5.2.30.0070.0179.98
5.2.20.0020.0199.97
5.2.10.0040.0199.93
5.2.00.0070.0149.86
5.1.60.0040.0139.50
5.1.50.0030.0159.50
5.1.40.0060.0129.49
5.1.30.0040.0169.66
5.1.20.0040.0169.67
5.1.10.0060.0129.54
5.1.00.0050.0159.54
5.0.50.0030.0118.78
5.0.40.0010.0138.71
5.0.30.0030.0188.61
5.0.20.0040.0158.60
5.0.10.0020.0168.59
5.0.00.0010.0228.58
4.4.90.0020.0127.84
4.4.80.0020.0177.83
4.4.70.0040.0127.83
4.4.60.0040.0117.82
4.4.50.0020.0147.83
4.4.40.0010.0197.80
4.4.30.0010.0137.83
4.4.20.0020.0127.87
4.4.10.0030.0107.87
4.4.00.0040.0147.83
4.3.110.0020.0097.78
4.3.100.0030.0117.78
4.3.90.0040.0107.77
4.3.80.0050.0187.74
4.3.70.0020.0107.77
4.3.60.0010.0107.76
4.3.50.0030.0097.76
4.3.40.0020.0147.71
4.3.30.0010.0107.10
4.3.20.0040.0077.09
4.3.10.0020.0097.07
4.3.00.0100.01110.72

preferences:
51.06 ms | 401 KiB | 5 Q