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 die($key ); $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();

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.88
8.3.50.0250.00822.01
8.3.40.0170.00018.79
8.3.30.0110.00419.17
8.3.20.0040.00420.24
8.3.10.0040.00423.62
8.3.00.0000.00919.48
8.2.180.0070.00716.75
8.2.170.0120.00322.96
8.2.160.0090.00520.37
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0030.01426.16
8.2.120.0040.00421.95
8.2.110.0030.00622.16
8.2.100.0040.00817.91
8.2.90.0030.00619.22
8.2.80.0000.00818.03
8.2.70.0030.00617.63
8.2.60.0000.00818.04
8.2.50.0100.00018.07
8.2.40.0000.00819.94
8.2.30.0030.00617.96
8.2.20.0040.00417.77
8.2.10.0050.00318.02
8.2.00.0070.00317.85
8.1.280.0150.00325.92
8.1.270.0080.00021.92
8.1.260.0030.00626.35
8.1.250.0070.00028.09
8.1.240.0060.00323.96
8.1.230.0040.00818.90
8.1.220.0040.00417.79
8.1.210.0060.00718.77
8.1.200.0060.00317.22
8.1.190.0050.00317.40
8.1.180.0080.00018.10
8.1.170.0030.00518.71
8.1.160.0000.00821.85
8.1.150.0000.00918.60
8.1.140.0000.00717.28
8.1.130.0070.00017.83
8.1.120.0030.00417.27
8.1.110.0030.00717.30
8.1.100.0050.00217.26
8.1.90.0080.00017.32
8.1.80.0000.00717.49
8.1.70.0030.00317.35
8.1.60.0000.00817.62
8.1.50.0040.00417.51
8.1.40.0000.00817.53
8.1.30.0090.00017.54
8.1.20.0040.00417.67
8.1.10.0000.00817.53
8.1.00.0040.00417.54
8.0.300.0040.00419.21
8.0.290.0060.00317.05
8.0.280.0030.00318.40
8.0.270.0070.00017.20
8.0.260.0000.00817.21
8.0.250.0000.00716.88
8.0.240.0070.00317.02
8.0.230.0070.00016.85
8.0.220.0000.00716.80
8.0.210.0060.00316.80
8.0.200.0030.00317.03
8.0.190.0000.00716.92
8.0.180.0050.00316.81
8.0.170.0030.00616.91
8.0.160.0050.00216.86
8.0.150.0040.00416.84
8.0.140.0000.00716.85
8.0.130.0040.00413.34
8.0.120.0050.00316.88
8.0.110.0080.00016.91
8.0.100.0000.00716.70
8.0.90.0040.00416.78
8.0.80.0130.00316.79
8.0.70.0040.00416.76
8.0.60.0000.00916.78
8.0.50.0050.00216.84
8.0.30.0070.01317.23
8.0.20.0050.01517.40
8.0.10.0070.00016.91
8.0.00.0080.01216.85
7.4.330.0050.00015.00
7.4.320.0030.00316.57
7.4.300.0030.00316.57
7.4.290.0110.00016.52
7.4.280.0030.00316.49
7.4.270.0040.00416.67
7.4.260.0000.00816.58
7.4.250.0040.00416.59
7.4.240.0000.00816.63
7.4.230.0030.00316.59
7.4.220.0090.00916.58
7.4.210.0040.01116.49
7.4.200.0070.00016.56
7.4.190.0030.00316.67
7.4.160.0090.00616.51
7.4.150.0140.01117.40
7.4.140.0050.01217.86
7.4.130.0100.00716.67
7.4.120.0070.01016.61
7.4.110.0090.00916.54
7.4.100.0000.02116.59
7.4.90.0090.00616.46
7.4.80.0050.01419.39
7.4.70.0050.01116.59
7.4.60.0150.00716.55
7.4.50.0040.00416.65
7.4.40.0070.00722.77
7.4.30.0060.01016.43
7.4.00.0070.00714.91
7.3.330.0030.00313.28
7.3.320.0050.00013.30
7.3.310.0040.00416.46
7.3.300.0040.00416.43
7.3.290.0130.00316.45
7.3.280.0120.00716.43
7.3.270.0100.01017.40
7.3.260.0180.00616.71
7.3.250.0100.01316.50
7.3.240.0090.01316.57
7.3.230.0110.00516.49
7.3.210.0060.01216.48
7.3.200.0130.00619.39
7.3.190.0070.01116.32
7.3.180.0130.00316.63
7.3.170.0100.00716.51
7.3.160.0140.00316.42
7.3.120.0070.01015.09
7.3.10.0100.00316.52
7.3.00.0030.01016.65
7.2.330.0130.00416.82
7.2.320.0070.01016.47
7.2.310.0070.01416.38
7.2.300.0140.00716.75
7.2.290.0140.00916.81
7.2.130.0060.01016.59
7.2.120.0110.00016.84
7.2.110.0070.00717.07
7.2.100.0150.00016.79
7.2.90.0000.01516.98
7.2.80.0070.00716.92
7.2.70.0040.00816.89
7.2.60.0060.00617.05
7.2.50.0070.00716.79
7.2.40.0030.01417.06
7.2.30.0070.00416.82
7.2.20.0110.00417.00
7.2.10.0000.01216.84
7.2.00.0070.00818.08
7.1.250.0030.01015.93
7.1.200.0040.01215.69
7.1.100.0070.01318.36
7.1.70.0030.00617.38
7.1.60.0080.01219.46
7.1.50.0040.01116.93
7.1.00.0070.07322.33
7.0.200.0040.00416.86
7.0.140.0030.07322.09
7.0.60.0000.04319.93
7.0.50.0100.04317.86
7.0.40.0100.04720.40
7.0.30.0470.07720.09
7.0.20.0330.05320.25
7.0.10.0030.08320.15
7.0.00.0130.08020.05
5.6.280.0030.07320.93
5.6.210.0070.08020.77
5.6.200.0130.08018.16
5.6.190.0100.08720.61
5.6.180.0130.04320.48
5.6.170.0270.04020.48
5.6.160.0070.08320.51
5.6.150.0000.04318.17
5.6.140.0030.04718.18
5.6.130.0100.07018.18
5.6.120.0070.04021.04
5.6.110.0200.03721.14
5.6.100.0030.09020.98
5.6.90.0130.07721.13
5.6.80.0270.06020.54
5.6.70.4600.03720.48
5.5.350.0200.03020.31
5.5.340.0130.07317.95
5.5.330.0070.04020.57
5.5.320.0270.05020.34
5.5.310.0170.05720.34
5.5.300.0030.04018.08
5.5.290.0070.08017.90
5.5.280.0070.05320.86
5.5.270.0100.07720.97
5.5.260.0100.04320.87
5.5.250.0070.07020.71
5.5.240.0300.06720.27
5.4.450.0600.06019.44
5.4.440.0630.06719.20
5.4.430.0670.06319.49
5.4.420.0070.05719.29
5.4.410.0170.06019.24
5.4.400.0830.05319.10
5.4.390.0270.07719.14
5.4.380.0430.06718.53
5.4.370.0630.04018.78
5.4.360.0330.07318.53
5.4.350.0470.06718.76
5.4.340.0470.06718.52
5.4.320.0070.04012.51
5.4.310.0070.03912.50
5.4.300.0110.03812.50
5.4.290.0130.05212.49
5.4.280.0070.05612.39
5.4.270.0110.03512.39
5.4.260.0080.03912.39
5.4.250.0040.04412.39
5.4.240.0090.04712.39
5.4.230.0100.03912.38
5.4.220.0060.03812.38
5.4.210.0050.04212.38
5.4.200.0030.04112.38
5.4.190.0060.03812.38
5.4.180.0080.03612.38
5.4.170.0050.04012.38
5.4.160.0100.03412.38
5.4.150.0050.04012.38
5.4.140.0080.03712.06
5.4.130.0110.04112.05
5.4.120.0070.04112.00
5.4.110.0050.04612.00
5.4.100.0090.05212.00
5.4.90.0050.05712.00
5.4.80.0100.05212.00
5.4.70.0150.05312.00
5.4.60.0100.03912.00
5.4.50.0090.04012.00
5.4.40.0070.03911.99
5.4.30.0030.04111.98
5.4.20.0040.04211.98
5.4.10.0080.03911.98
5.4.00.0100.03711.47
5.3.290.0070.04512.80
5.3.280.0060.04212.71
5.3.270.0070.04212.72
5.3.260.0100.04612.72
5.3.250.0100.04512.72
5.3.240.0100.04912.72
5.3.230.0090.05312.71
5.3.220.0080.05512.68
5.3.210.0090.05212.68
5.3.200.0080.05912.68
5.3.190.0060.04212.68
5.3.180.0070.03612.68
5.3.170.0110.03412.67
5.3.160.0130.04712.68
5.3.150.0070.04212.68
5.3.140.0150.05712.66
5.3.130.0160.05912.66
5.3.120.0170.07912.66
5.3.110.0170.08212.66
5.3.100.0110.05312.13
5.3.90.0090.05012.11
5.3.80.0050.05012.10
5.3.70.0190.06712.10
5.3.60.0110.05812.09
5.3.50.0130.05012.03
5.3.40.0110.05412.03
5.3.30.0140.04811.99
5.3.20.0070.05011.77
5.3.10.0090.05011.74
5.3.00.0090.06211.72
5.2.170.0110.0379.23
5.2.160.0070.0339.23
5.2.150.0090.0319.23
5.2.140.0030.0359.23
5.2.130.0100.0379.19
5.2.120.0090.0289.19
5.2.110.0110.0279.20
5.2.100.0070.0349.19
5.2.90.0080.0419.19
5.2.80.0120.0409.18
5.2.70.0060.0359.18
5.2.60.0120.0529.13
5.2.50.0110.0459.11
5.2.40.0050.0359.09
5.2.30.0080.0309.06
5.2.20.0070.0299.04
5.2.10.0060.0288.95
5.2.00.0040.0318.82
5.1.60.0090.0338.10
5.1.50.0060.0288.10
5.1.40.0070.0248.07
5.1.30.0070.0308.43
5.1.20.0070.0288.45
5.1.10.0040.0338.17
5.1.00.0080.0298.18
5.0.50.0040.0266.65
5.0.40.0050.0186.52
5.0.30.0050.0306.32
5.0.20.0040.0246.29
5.0.10.0060.0296.27
5.0.00.0040.0436.26
4.4.90.0080.0254.78
4.4.80.0040.0254.76
4.4.70.0040.0184.75
4.4.60.0040.0164.76
4.4.50.0040.0174.77
4.4.40.0050.0334.70
4.4.30.0040.0234.76
4.4.20.0030.0234.84
4.4.10.0030.0234.85
4.4.00.0040.0324.76
4.3.110.0050.0214.67
4.3.100.0050.0224.67
4.3.90.0030.0224.64
4.3.80.0040.0254.58
4.3.70.0030.0164.63
4.3.60.0030.0164.63
4.3.50.0010.0254.63
4.3.40.0050.0344.54
4.3.30.0050.0333.30
4.3.20.0030.0223.28
4.3.10.0040.0263.23
4.3.00.0100.01310.54

preferences:
46.32 ms | 401 KiB | 5 Q