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[0] = 'dobee'; //$test->__set($array[$first_key] , $blah ); foreach($array as $k => $v) { var_dump($k); if($k == "Testsecret") { print_r($array[$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.0110.00416.75
8.3.50.0170.00318.07
8.3.40.0100.00719.02
8.3.30.0040.01119.14
8.3.20.0070.00020.21
8.3.10.0000.00723.52
8.3.00.0000.00919.51
8.2.180.0060.01218.43
8.2.170.0110.00722.96
8.2.160.0100.00320.35
8.2.150.0040.01424.18
8.2.140.0000.00824.66
8.2.130.0030.01626.16
8.2.120.0040.00422.12
8.2.110.0060.00320.21
8.2.100.0120.00017.84
8.2.90.0030.00519.18
8.2.80.0000.00817.97
8.2.70.0090.00017.88
8.2.60.0090.00018.03
8.2.50.0070.00318.07
8.2.40.0030.00519.89
8.2.30.0050.00318.03
8.2.20.0000.00817.84
8.2.10.0000.00918.22
8.2.00.0070.00417.73
8.1.270.0090.00023.91
8.1.260.0000.00826.35
8.1.250.0080.00028.09
8.1.240.0030.00717.36
8.1.230.0090.00319.04
8.1.220.0050.00317.74
8.1.210.0060.00318.77
8.1.200.0000.01017.36
8.1.190.0050.00317.52
8.1.180.0090.00019.13
8.1.170.0090.00018.57
8.1.160.0000.00722.02
8.1.150.0040.00718.67
8.1.140.0040.00417.48
8.1.130.0000.00717.96
8.1.120.0000.00717.53
8.1.110.0080.00317.42
8.1.100.0040.00417.49
8.1.90.0000.00717.49
8.1.80.0000.00717.34
8.1.70.0050.00217.45
8.1.60.0000.00817.59
8.1.50.0000.00817.43
8.1.40.0000.00817.45
8.1.30.0000.00817.66
8.1.20.0000.00817.67
8.1.10.0040.00417.45
8.1.00.0000.00717.46
8.0.300.0040.00418.77
8.0.290.0040.00417.18
8.0.280.0000.00718.47
8.0.270.0030.00317.20
8.0.260.0000.00617.20
8.0.250.0070.00017.11
8.0.240.0000.00817.01
8.0.230.0050.00317.01
8.0.220.0000.00716.98
8.0.210.0030.00317.00
8.0.200.0000.00717.08
8.0.190.0030.00516.95
8.0.180.0050.00216.98
8.0.170.0030.00516.91
8.0.160.0000.00716.96
8.0.150.0030.00516.87
8.0.140.0030.00616.93
8.0.130.0030.00613.44
8.0.120.0050.00216.84
8.0.110.0000.00816.92
8.0.100.0000.00816.93
8.0.90.0000.00716.81
8.0.80.0120.00617.02
8.0.70.0000.00717.02
8.0.60.0030.00516.96
8.0.50.0070.00016.92
8.0.30.0120.00717.18
8.0.20.0110.00917.40
8.0.10.0020.00517.05
8.0.00.0090.01016.71
7.4.330.0000.00515.00
7.4.320.0030.00316.62
7.4.300.0000.00716.61
7.4.290.0030.00316.44
7.4.280.0070.00016.52
7.4.270.0050.00216.59
7.4.260.0030.00316.45
7.4.250.0040.00416.51
7.4.240.0040.00416.56
7.4.230.0000.00716.55
7.4.220.0120.00616.61
7.4.210.0060.01016.63
7.4.200.0040.00416.70
7.4.190.0070.00016.68
7.4.160.0060.01016.54
7.4.150.0030.01417.40
7.4.140.0130.00517.86
7.4.130.0120.00616.54
7.4.120.0110.00816.67
7.4.110.0070.01016.39
7.4.100.0110.00816.41
7.4.90.0050.01416.73
7.4.80.0100.01319.39
7.4.70.0140.00616.60
7.4.60.0100.00716.41
7.4.50.0030.00316.54
7.4.40.0130.00322.77
7.4.30.0120.00716.62
7.4.00.0050.01114.92
7.3.330.0000.00613.35
7.3.320.0060.00013.22
7.3.310.0000.00716.45
7.3.300.0080.00016.47
7.3.290.0040.01116.56
7.3.280.0070.01016.38
7.3.270.0100.00717.40
7.3.260.0100.00916.52
7.3.250.0090.00916.54
7.3.240.0130.00916.59
7.3.230.0070.01216.51
7.3.210.0060.01216.47
7.3.200.0100.00616.34
7.3.190.0120.00916.34
7.3.180.0060.00916.64
7.3.170.0100.00616.56
7.3.160.0050.01116.41
7.3.120.0070.00914.90
7.3.110.0080.00914.80
7.3.100.0060.00914.68
7.3.90.0120.00214.90
7.3.80.0090.00315.05
7.3.70.0030.01014.81
7.3.60.0040.00914.82
7.3.50.0060.00614.91
7.3.40.0060.00514.93
7.3.30.0050.00914.88
7.3.20.0020.01216.54
7.3.10.0080.00716.47
7.3.00.0060.00716.59
7.2.330.0090.00916.71
7.2.320.0070.01016.86
7.2.310.0140.00316.48
7.2.300.0070.01016.61
7.2.290.0130.00316.75
7.2.250.0080.00615.24
7.2.240.0130.00715.16
7.2.230.0030.01115.18
7.2.220.0040.01115.21
7.2.210.0040.01114.98
7.2.200.0030.01214.94
7.2.190.0100.00515.09
7.2.180.0050.00615.00
7.2.170.0060.00915.02
7.2.160.0070.00714.72
7.2.150.0000.01416.93
7.2.140.0040.00717.03
7.2.130.0100.00516.91
7.2.120.0050.01116.78
7.2.110.0090.00816.81
7.2.100.0050.00716.75
7.2.90.0090.00816.74
7.2.80.0130.00916.73
7.2.70.0110.00616.93
7.2.60.0090.00616.85
7.2.50.0080.01116.75
7.2.40.0120.00716.96
7.2.30.0130.00716.86
7.2.20.0090.00716.73
7.2.10.0080.01016.76
7.2.00.0080.01017.94
7.1.330.0080.00715.77
7.1.320.0070.00915.82
7.1.310.0070.00516.03
7.1.300.0070.00515.79
7.1.290.0050.00815.65
7.1.280.0040.01115.79
7.1.270.0100.00415.77
7.1.260.0070.00715.74
7.1.250.0050.00915.54
7.1.240.0060.00915.69
7.1.230.0060.00915.82
7.1.220.0060.00615.90
7.1.210.0070.00715.82
7.1.200.0070.00715.78
7.1.190.0030.01016.06
7.1.180.0070.00715.54
7.1.170.0040.00415.71
7.1.160.0000.01615.74
7.1.150.0150.00415.68
7.1.140.0070.00715.53
7.1.130.0120.00315.84
7.1.120.0080.00815.92
7.1.110.0030.01215.92
7.1.100.0030.01017.12
7.1.90.0030.01215.95
7.1.80.0000.01215.85
7.1.70.0050.00816.36
7.1.60.0090.00817.68
7.1.50.0110.00816.31
7.1.40.0030.00616.06
7.1.30.0030.00715.82
7.1.20.0130.00315.81
7.1.10.0080.00815.91
7.1.00.0050.04319.24
7.0.330.0040.01115.41
7.0.320.0050.00515.23
7.0.310.0040.00815.38
7.0.300.0030.01315.10
7.0.290.0060.00615.45
7.0.280.0140.00415.59
7.0.270.0030.00715.18
7.0.260.0100.00715.61
7.0.250.0040.01115.07
7.0.240.0080.00015.55
7.0.230.0070.00715.62
7.0.220.0030.00615.15
7.0.210.0100.00015.55
7.0.200.0020.00816.08
7.0.190.0060.00615.55
7.0.180.0040.00815.48
7.0.170.0070.00715.27
7.0.160.0000.01415.58
7.0.150.0000.01215.23
7.0.140.0030.03718.70
7.0.130.0000.01515.29
7.0.120.0000.01215.54
7.0.110.0070.00315.48
7.0.100.0070.00715.44
7.0.90.0040.00815.39
7.0.80.0000.00915.27
7.0.70.0000.01215.45
7.0.60.0110.03017.73
7.0.50.0070.04316.71
7.0.40.0090.02616.63
7.0.30.0270.03716.67
7.0.20.0130.04616.76
7.0.10.0080.02516.96
7.0.00.0080.04316.88
5.6.400.0040.01114.29
5.6.390.0110.00014.73
5.6.380.0030.00914.37
5.6.370.0030.01414.50
5.6.360.0070.00714.45
5.6.350.0070.01014.68
5.6.340.0110.00414.64
5.6.330.0090.00614.37
5.6.320.0100.00714.72
5.6.310.0060.00814.37
5.6.300.0030.01014.45
5.6.290.0000.01114.35
5.6.280.0050.04017.69
5.6.270.0070.00714.48
5.6.260.0090.01214.25
5.6.250.0070.01414.66
5.6.240.0070.00714.53
5.6.230.0030.01014.38
5.6.220.0030.01314.28
5.6.210.0050.04617.65
5.6.200.0080.04516.27
5.6.190.0070.04817.59
5.6.180.0150.04717.45
5.6.170.0190.04217.54
5.6.160.0050.02417.60
5.6.150.0080.04216.22
5.6.140.0050.04816.34
5.6.130.0050.02416.24
5.6.120.0070.02717.77
5.6.110.0100.03917.75
5.6.100.0050.04717.63
5.6.90.0050.02817.79
5.6.80.0070.04717.47
5.6.70.2080.02317.57
5.6.60.0030.01014.54
5.6.50.0060.00914.52
5.6.40.0000.01214.55
5.6.30.0100.00714.31
5.6.20.0000.01114.58
5.6.10.0040.00714.36
5.6.00.0030.00614.23
5.5.380.0070.00714.71
5.5.370.0090.00914.85
5.5.360.0030.01014.64
5.5.350.0170.04217.43
5.5.340.0070.03216.20
5.5.330.0070.03217.24
5.5.320.0180.04217.35
5.5.310.0190.03317.48
5.5.300.0030.04516.24
5.5.290.0050.04416.24
5.5.280.0040.03717.63
5.5.270.0020.02917.64
5.5.260.0130.04417.54
5.5.250.0020.02517.64
5.5.240.1360.02117.23
5.5.230.0060.00614.30
5.5.220.0030.01014.43
5.5.210.0060.00614.34
5.5.200.0040.00814.39
5.5.190.0070.00714.27
5.5.180.0070.01014.56
5.5.170.0060.00614.44
5.5.160.0060.00314.45
5.5.150.0000.01514.13
5.5.140.0060.01214.24
5.5.130.0090.00914.30
5.5.120.0070.00614.54
5.5.110.0000.01414.46
5.5.100.0030.00714.16
5.5.90.0060.00914.51
5.5.80.0030.01314.46
5.5.70.0040.00714.20
5.5.60.0070.01114.07
5.5.50.0090.00614.10
5.5.40.0040.01214.20
5.5.30.0000.01213.89
5.5.20.0070.00414.43
5.5.10.0060.00314.03
5.5.00.0030.01014.17
5.4.450.0420.03415.28
5.4.440.0430.03715.32
5.4.430.0340.03415.19
5.4.420.0430.03315.38
5.4.410.0500.03215.23
5.4.400.0350.03215.00
5.4.390.0370.03315.17
5.4.380.0140.03215.00
5.4.370.0200.03014.91
5.4.360.0210.02214.83
5.4.350.0120.03715.00
5.4.340.0180.03314.90
5.4.330.0070.00411.08
5.4.320.0050.02311.82
5.4.310.0040.02411.79
5.4.300.0060.02311.88
5.4.290.0100.02111.80
5.4.280.0070.02311.83
5.4.270.0080.02411.87
5.4.260.0060.02911.85
5.4.250.0050.03611.73
5.4.240.0080.02711.73
5.4.230.0070.02911.73
5.4.220.0120.04011.76
5.4.210.0090.02611.73
5.4.200.0070.03011.74
5.4.190.0060.05711.81
5.4.180.0080.02211.76
5.4.170.0040.02811.81
5.4.160.0070.02211.73
5.4.150.0090.03011.85
5.4.140.0050.05311.57
5.4.130.0040.02911.61
5.4.120.0060.02811.55
5.4.110.0040.03011.62
5.4.100.0050.02611.54
5.4.90.0070.02011.55
5.4.80.0050.02211.65
5.4.70.0040.02211.54
5.4.60.0020.02711.67
5.4.50.0060.02611.59
5.4.40.0050.02111.53
5.4.30.0080.02311.53
5.4.20.0090.02811.53
5.4.10.0050.02311.53
5.4.00.0040.02711.36
5.3.290.0070.01911.94
5.3.280.0050.02811.90
5.3.270.0090.02011.90
5.3.260.0050.02511.90
5.3.250.0050.02411.90
5.3.240.0070.04111.90
5.3.230.0080.03111.89
5.3.220.0080.04411.88
5.3.210.0090.03711.88
5.3.200.0130.04011.88
5.3.190.0110.05911.88
5.3.180.0080.02811.88
5.3.170.0060.03111.88
5.3.160.0080.02811.88
5.3.150.0080.02611.88
5.3.140.0050.02411.87
5.3.130.0060.02811.87
5.3.120.0040.03311.87
5.3.110.0110.03211.87
5.3.100.0060.02711.61
5.3.90.0080.02611.59
5.3.80.0060.02511.59
5.3.70.0060.02511.59
5.3.60.0040.02511.58
5.3.50.0040.03211.56
5.3.40.0040.02711.56
5.3.30.0060.02311.53
5.3.20.0020.02611.43
5.3.10.0070.02511.41
5.3.00.0070.03111.40
5.2.170.0050.0469.23
5.2.160.0110.0389.23
5.2.150.0050.0469.23
5.2.140.0120.0399.23
5.2.130.0070.0419.19
5.2.120.0070.0419.19
5.2.110.0070.0399.20
5.2.100.0060.0429.19
5.2.90.0130.0489.19
5.2.80.0030.0369.18
5.2.70.0070.0329.18
5.2.60.0070.0349.14
5.2.50.0060.0359.10
5.2.40.0200.0639.08
5.2.30.0080.0759.06
5.2.20.0100.0559.04
5.2.10.0410.1168.95
5.2.00.0080.0538.82
5.1.60.0050.0268.10
5.1.50.0060.0258.09
5.1.40.0050.0278.07
5.1.30.0100.0238.43
5.1.20.0080.0358.45
5.1.10.0140.0578.18
5.1.00.0050.0418.17
5.0.50.0030.0356.65
5.0.40.0050.0276.52
5.0.30.0060.0436.32
5.0.20.0060.0326.29
5.0.10.0040.0296.27
5.0.00.0060.0426.27
4.4.90.0040.0234.78
4.4.80.0030.0224.75
4.4.70.0020.0254.75
4.4.60.0070.0194.76
4.4.50.0050.0224.77
4.4.40.0040.0354.71
4.4.30.0010.0244.76
4.4.20.0020.0244.84
4.4.10.0040.0264.85
4.4.00.0040.0294.76
4.3.110.0060.0174.67
4.3.100.0030.0154.67
4.3.90.0070.0314.63
4.3.80.0030.0344.58
4.3.70.0010.0204.63
4.3.60.0030.0234.63
4.3.50.0040.0234.63
4.3.40.0020.0364.54
4.3.30.0040.0223.30
4.3.20.0000.0203.28
4.3.10.0020.0163.24
4.3.00.0370.01710.54

preferences:
54.98 ms | 400 KiB | 5 Q