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('here'.$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.0140.00018.56
8.3.50.0230.01022.02
8.3.40.0100.01018.92
8.3.30.0110.00419.26
8.3.20.0000.00720.39
8.3.10.0040.00423.61
8.3.00.0050.00319.50
8.2.180.0100.01018.18
8.2.170.0070.00722.96
8.2.160.0070.00720.43
8.2.150.0080.00024.18
8.2.140.0090.00024.66
8.2.130.0030.00726.16
8.2.120.0080.00022.25
8.2.110.0000.00822.26
8.2.100.0110.00017.91
8.2.90.0000.00819.22
8.2.80.0080.00017.97
8.2.70.0030.00717.75
8.2.60.0000.00817.80
8.2.50.0040.00818.07
8.2.40.0060.00319.76
8.2.30.0050.00218.11
8.2.20.0040.00417.71
8.2.10.0000.00718.09
8.2.00.0080.00517.69
8.1.280.0130.00725.92
8.1.270.0060.00321.94
8.1.260.0120.00326.35
8.1.250.0070.00728.09
8.1.240.0060.00323.97
8.1.230.0110.00019.16
8.1.220.0060.00317.74
8.1.210.0000.00918.77
8.1.200.0000.00817.35
8.1.190.0040.00417.51
8.1.180.0060.00319.13
8.1.170.0060.00318.53
8.1.160.0030.00622.03
8.1.150.0000.01018.61
8.1.140.0060.00317.41
8.1.130.0030.00317.84
8.1.120.0000.00717.46
8.1.110.0020.00517.33
8.1.100.0030.00817.47
8.1.90.0020.00517.41
8.1.80.0000.00717.43
8.1.70.0030.00317.52
8.1.60.0060.00317.62
8.1.50.0000.00817.50
8.1.40.0030.00617.47
8.1.30.0040.00417.68
8.1.20.0000.00917.51
8.1.10.0000.00817.58
8.1.00.0000.00817.53
8.0.300.0030.00520.65
8.0.290.0000.00717.04
8.0.280.0030.00518.41
8.0.270.0030.00317.24
8.0.260.0040.00418.34
8.0.250.0070.00016.87
8.0.240.0050.00216.98
8.0.230.0030.00317.03
8.0.220.0030.00416.99
8.0.210.0000.00716.98
8.0.200.0040.00416.97
8.0.190.0090.00017.05
8.0.180.0070.00016.88
8.0.170.0040.00416.94
8.0.160.0040.00416.98
8.0.150.0000.00816.80
8.0.140.0050.00316.89
8.0.130.0070.00013.34
8.0.120.0050.00316.87
8.0.110.0000.00716.93
8.0.100.0050.00316.96
8.0.90.0020.00516.84
8.0.80.0060.00916.92
8.0.70.0040.00416.99
8.0.60.0000.00716.88
8.0.50.0000.00816.84
8.0.30.0090.00917.10
8.0.20.0050.01417.40
8.0.10.0080.00016.94
8.0.00.0110.00716.86
7.4.330.0000.00515.05
7.4.320.0060.00016.53
7.4.300.0000.00616.55
7.4.290.0070.00016.53
7.4.280.0040.00416.63
7.4.270.0000.00716.63
7.4.260.0030.00316.52
7.4.250.0000.00816.60
7.4.240.0050.00216.61
7.4.230.0000.00716.38
7.4.220.0130.00316.67
7.4.210.0060.00816.60
7.4.200.0000.00716.52
7.4.190.0000.00716.45
7.4.160.0060.00916.55
7.4.150.0100.00717.40
7.4.140.0140.00817.86
7.4.130.0120.00816.52
7.4.120.0060.01316.49
7.4.110.0100.00716.47
7.4.100.0170.00316.55
7.4.90.0030.01416.52
7.4.80.0130.00619.39
7.4.70.0060.01216.62
7.4.60.0110.00816.61
7.4.50.0070.00016.40
7.4.40.0000.01922.77
7.4.30.0170.00616.68
7.4.10.0070.01115.22
7.4.00.0010.01614.78
7.3.330.0030.00313.44
7.3.320.0000.00513.52
7.3.310.0030.00616.33
7.3.300.0020.00716.50
7.3.290.0000.01616.38
7.3.280.0050.01016.43
7.3.270.0030.01317.40
7.3.260.0030.01316.48
7.3.250.0090.00916.50
7.3.240.0100.00616.47
7.3.230.0100.01316.44
7.3.210.0140.00316.41
7.3.200.0130.01019.39
7.3.190.0120.00616.48
7.3.180.0030.01316.50
7.3.170.0100.00616.36
7.3.160.0040.01216.60
7.3.130.0030.00915.04
7.3.120.0090.00614.70
7.3.110.0130.00615.00
7.3.100.0070.00715.02
7.3.90.0000.01214.94
7.3.80.0090.00314.68
7.3.70.0040.01114.80
7.3.60.0040.01414.48
7.3.50.0000.01114.88
7.3.40.0110.00414.86
7.3.30.0030.01314.83
7.3.20.0090.00316.38
7.3.10.0130.00316.59
7.3.00.0030.01516.75
7.2.330.0160.00416.32
7.2.320.0100.00716.77
7.2.310.0030.01316.40
7.2.300.0030.01416.86
7.2.290.0100.00716.91
7.2.260.0000.02015.10
7.2.250.0090.00915.28
7.2.240.0070.00715.22
7.2.230.0030.01315.22
7.2.220.0040.01114.84
7.2.210.0040.00815.34
7.2.200.0070.00715.08
7.2.190.0070.00315.20
7.2.180.0100.00714.75
7.2.170.0110.00714.98
7.2.160.0040.01115.03
7.2.150.0000.01116.83
7.2.140.0070.00716.97
7.2.130.0070.01016.95
7.2.120.0030.01316.54
7.2.110.0030.01416.85
7.2.100.0070.01016.85
7.2.90.0060.01017.05
7.2.80.0050.00516.92
7.2.70.0060.01216.64
7.2.60.0100.00616.77
7.2.50.0040.01416.89
7.2.40.0090.00616.73
7.2.30.0000.01217.08
7.2.20.0030.00916.84
7.2.10.0000.01117.13
7.2.00.0020.01118.24
7.1.330.0040.01115.62
7.1.320.0030.01015.80
7.1.310.0100.00315.65
7.1.300.0040.00715.75
7.1.290.0080.00315.91
7.1.280.0000.01615.65
7.1.270.0080.00315.70
7.1.260.0090.00915.62
7.1.250.0100.00715.93
7.1.240.0070.00715.78
7.1.230.0040.01115.87
7.1.220.0040.01115.66
7.1.210.0040.01115.97
7.1.200.0050.00715.84
7.1.190.0000.01115.87
7.1.180.0030.01215.78
7.1.170.0040.01115.77
7.1.160.0030.00915.61
7.1.150.0030.00615.57
7.1.140.0000.00915.79
7.1.130.0000.01115.82
7.1.120.0070.00715.86
7.1.110.0080.00515.91
7.1.100.0060.00916.97
7.1.90.0080.00815.94
7.1.80.0000.01315.94
7.1.70.0020.00916.46
7.1.60.0070.01317.52
7.1.50.0100.00816.39
7.1.40.0000.01515.69
7.1.30.0040.00415.93
7.1.20.0000.01115.51
7.1.10.0040.01115.85
7.1.00.0120.03519.07
7.0.330.0030.01315.30
7.0.320.0030.00915.34
7.0.310.0030.01015.15
7.0.300.0110.00415.41
7.0.290.0060.00615.63
7.0.280.0040.00715.50
7.0.270.0030.01015.33
7.0.260.0000.01215.64
7.0.250.0060.01015.19
7.0.240.0040.01115.16
7.0.230.0100.00315.57
7.0.220.0030.00615.34
7.0.210.0000.00915.20
7.0.200.0050.00515.94
7.0.190.0090.00615.29
7.0.180.0040.00715.23
7.0.170.0000.01015.38
7.0.160.0030.01015.46
7.0.150.0050.00315.48
7.0.140.0100.03718.71
7.0.130.0100.00715.42
7.0.120.0110.00415.46
7.0.110.0090.00315.56
7.0.100.0020.03917.75
7.0.90.0070.03017.71
7.0.80.0020.04817.69
7.0.70.0160.03017.74
7.0.60.0080.03617.53
7.0.50.0150.03517.87
7.0.40.0030.04516.72
7.0.30.0070.02916.81
7.0.20.0070.03916.82
7.0.10.0030.04616.85
7.0.00.0060.02216.78
5.6.400.0070.01014.50
5.6.390.0110.00014.67
5.6.380.0070.00714.36
5.6.370.0100.00314.74
5.6.360.0080.00414.24
5.6.350.0030.00714.30
5.6.340.0000.01313.98
5.6.330.0100.00314.72
5.6.320.0040.01214.86
5.6.310.0040.00414.52
5.6.300.0040.01114.34
5.6.290.0040.01114.41
5.6.280.0080.03817.74
5.6.270.0070.00314.23
5.6.260.0000.01414.16
5.6.250.0050.02317.52
5.6.240.0080.03717.54
5.6.230.0050.04017.47
5.6.220.0150.03317.54
5.6.210.0050.05017.41
5.6.200.0070.03117.66
5.6.190.0070.02217.68
5.6.180.0070.02317.77
5.6.170.0040.03917.91
5.6.160.0130.03617.78
5.6.150.0040.02817.90
5.6.140.0060.02217.64
5.6.130.0000.04217.74
5.6.120.0080.04817.81
5.6.110.0050.03517.80
5.6.100.0050.04717.73
5.6.90.0050.04617.72
5.6.80.0050.03217.38
5.6.70.0080.04317.41
5.6.60.0090.03517.38
5.6.50.0070.04317.44
5.6.40.0050.03717.42
5.6.30.0070.04117.45
5.6.20.0080.04017.27
5.6.10.0100.04217.39
5.6.00.0070.04817.28
5.5.380.0110.03617.28
5.5.370.0030.02617.52
5.5.360.0020.03417.44
5.5.350.0050.02817.36
5.5.340.0060.04517.64
5.5.330.0090.04317.59
5.5.320.0020.02817.74
5.5.310.0030.03117.65
5.5.300.0030.04717.74
5.5.290.0070.02717.65
5.5.280.0100.04517.64
5.5.270.0020.05417.68
5.5.260.0080.04217.69
5.5.250.0090.04517.53
5.5.240.0110.03317.32
5.5.230.0040.04417.17
5.5.220.0080.03617.20
5.5.210.0110.03917.24
5.5.200.0110.04017.14
5.5.190.0070.04317.32
5.5.180.0120.03217.30
5.5.170.0100.00314.36
5.5.160.0100.04017.19
5.5.150.0120.04017.28
5.5.140.0120.03917.33
5.5.130.0080.04117.32
5.5.120.0070.02217.42
5.5.110.0030.04217.34
5.5.100.0070.04217.18
5.5.90.0110.03817.27
5.5.80.0050.02317.20
5.5.70.0130.02217.26
5.5.60.0050.02817.38
5.5.50.0050.04117.09
5.5.40.0080.04217.29
5.5.30.0050.04517.09
5.5.20.0060.02317.17
5.5.10.0070.04017.08
5.5.00.0050.04117.10
5.4.450.0100.03815.32
5.4.440.0060.03015.26
5.4.430.0050.04315.35
5.4.420.0100.03715.29
5.4.410.0060.04215.33
5.4.400.0030.04015.06
5.4.390.0080.03615.07
5.4.380.0030.02515.15
5.4.370.0050.03315.01
5.4.360.0080.03815.08
5.4.350.0080.03815.06
5.4.340.0040.02715.15
5.4.330.0040.00710.93
5.4.320.0060.02615.30
5.4.310.0030.03115.32
5.4.300.0050.03815.01
5.4.290.0050.04115.19
5.4.280.0100.03615.13
5.4.270.0020.04415.22
5.4.260.0030.04215.12
5.4.250.0030.04715.14
5.4.240.0110.03715.07
5.4.230.0110.04014.97
5.4.220.0070.03815.12
5.4.210.0050.02115.19
5.4.200.0030.04115.20
5.4.190.0070.03015.16
5.4.180.0020.03815.33
5.4.170.0020.04215.03
5.4.160.0120.02214.98
5.4.150.0060.02115.22
5.4.140.0070.03713.89
5.4.130.0050.04013.71
5.4.120.0050.03513.73
5.4.110.0100.03813.99
5.4.100.0030.03713.85
5.4.90.0070.04013.78
5.4.80.0020.04013.78
5.4.70.0070.03613.67
5.4.60.0030.02813.92
5.4.50.0080.03613.79
5.4.40.0050.04213.82
5.4.30.0050.02313.89
5.4.20.0080.03313.82
5.4.10.0120.02813.78
5.4.00.0050.03813.43
5.3.290.0050.03912.74
5.3.280.0100.03512.66
5.3.270.0070.04012.65
5.3.260.0050.04012.64
5.3.250.0080.03612.63
5.3.240.0020.02212.63
5.3.230.0080.04212.61
5.3.220.0020.04412.65
5.3.210.0020.03512.71
5.3.200.0030.02712.63
5.3.190.0070.03712.54
5.3.180.0060.03912.61
5.3.170.0110.03212.54
5.3.160.0020.04712.63
5.3.150.0020.03812.72
5.3.140.0050.02412.69
5.3.130.0020.04312.55
5.3.120.0020.04512.66
5.3.110.0060.03812.50
5.3.100.0020.04712.41
5.3.90.0040.03712.31
5.3.80.0050.02112.28
5.3.70.0020.02212.40
5.3.60.0000.02312.27
5.3.50.0070.01712.34
5.3.40.0060.02712.33
5.3.30.0050.03212.32
5.3.20.0100.03312.18
5.3.10.0080.01712.13
5.3.00.0070.02812.05
5.2.170.0030.06011.16
5.2.160.0030.06311.16
5.2.150.0070.06311.04
5.2.140.0100.05711.21
5.2.130.0000.03311.25
5.2.120.0030.04011.21
5.2.110.0030.03311.13
5.2.100.0000.03011.25
5.2.90.0070.02311.25
5.2.80.0030.06311.04
5.2.70.0030.06311.02
5.2.60.0000.06010.98
5.2.50.0100.05711.10
5.2.40.0030.05011.10
5.2.30.0000.05010.89
5.2.20.0000.06310.97
5.2.10.0070.05710.92
5.2.00.0070.05310.85
5.1.60.0030.05010.01
5.1.50.0030.05310.04
5.1.40.0030.0539.82
5.1.30.0030.06010.26
5.1.20.0030.04710.29
5.1.10.0000.0479.92
5.1.00.0030.03710.16
5.0.50.0030.0208.89
5.0.40.0070.0338.89
5.0.30.0030.0638.89
5.0.20.0070.0208.89
5.0.10.0100.0178.89
5.0.00.0000.0708.89
4.4.90.0030.0308.89
4.4.80.0070.0238.89
4.4.70.0000.0338.89
4.4.60.0030.0378.89
4.4.50.0030.0338.89
4.4.40.0030.0578.89
4.4.30.0000.0308.89
4.4.20.0070.0238.89
4.4.10.0000.0178.89
4.4.00.0000.0278.89
4.3.110.0030.0308.89
4.3.100.0030.0378.89
4.3.90.0030.0208.89
4.3.80.0070.0238.89
4.3.70.0000.0208.89
4.3.60.0030.0308.89
4.3.50.0000.0378.89
4.3.40.0030.0378.89
4.3.30.0030.0238.89
4.3.20.0000.0238.89
4.3.10.0030.0378.89
4.3.00.0000.0378.89

preferences:
45.9 ms | 401 KiB | 5 Q