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; print_r($array['Testsecret']); } } $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.0070.01416.75
8.3.50.0160.00621.99
8.3.40.0120.00618.71
8.3.30.0100.01019.09
8.3.20.0140.00420.39
8.3.10.0080.00023.65
8.3.00.0050.00319.26
8.2.180.0040.01118.56
8.2.170.0070.00722.96
8.2.160.0030.01020.53
8.2.150.0000.00824.18
8.2.140.0030.00524.66
8.2.130.0160.00326.16
8.2.120.0100.00722.08
8.2.110.0070.00322.24
8.2.100.0040.00717.84
8.2.90.0040.00419.26
8.2.80.0040.00417.97
8.2.70.0040.00417.59
8.2.60.0030.00617.93
8.2.50.0040.00418.07
8.2.40.0030.00619.94
8.2.30.0000.00818.13
8.2.20.0000.00817.78
8.2.10.0040.00418.07
8.2.00.0030.00717.74
8.1.280.0030.01225.92
8.1.270.0060.00322.10
8.1.260.0070.00726.35
8.1.250.0070.01028.09
8.1.240.0000.01023.75
8.1.230.0070.00419.10
8.1.220.0040.00417.74
8.1.210.0080.00018.77
8.1.200.0070.00317.23
8.1.190.0080.00017.18
8.1.180.0030.00619.01
8.1.170.0080.00418.38
8.1.160.0000.00721.86
8.1.150.0030.00518.50
8.1.140.0050.00317.36
8.1.130.0000.00717.73
8.1.120.0000.00717.43
8.1.110.0040.00417.36
8.1.100.0050.00217.40
8.1.90.0040.00417.43
8.1.80.0070.00017.38
8.1.70.0040.00417.47
8.1.60.0080.00017.62
8.1.50.0080.00017.53
8.1.40.0000.00717.54
8.1.30.0000.00817.62
8.1.20.0040.00417.52
8.1.10.0040.00417.57
8.1.00.0030.00617.51
8.0.300.0040.00418.77
8.0.290.0040.00417.05
8.0.280.0000.00718.32
8.0.270.0000.00717.16
8.0.260.0060.00017.18
8.0.250.0050.00317.01
8.0.240.0030.00516.96
8.0.230.0000.00716.87
8.0.220.0030.00316.92
8.0.210.0040.00416.92
8.0.200.0070.00016.96
8.0.190.0000.00816.98
8.0.180.0050.00316.95
8.0.170.0040.00416.86
8.0.160.0030.00516.84
8.0.150.0000.00716.80
8.0.140.0070.00016.69
8.0.130.0070.00013.33
8.0.120.0000.00816.82
8.0.110.0040.00416.72
8.0.100.0000.00816.86
8.0.90.0000.00716.72
8.0.80.0000.01616.78
8.0.70.0000.00716.95
8.0.60.0050.00316.79
8.0.50.0040.00416.96
8.0.30.0130.00517.10
8.0.20.0150.00817.40
8.0.10.0040.00416.86
8.0.00.0120.00416.81
7.4.330.0030.00315.00
7.4.320.0000.00716.61
7.4.300.0030.00316.53
7.4.290.0000.00716.57
7.4.280.0000.00716.57
7.4.270.0000.00716.62
7.4.260.0040.00416.60
7.4.250.0070.00016.47
7.4.240.0040.00316.54
7.4.230.0000.00716.34
7.4.220.0060.01416.45
7.4.210.0070.00816.60
7.4.200.0030.00316.58
7.4.190.0070.00016.45
7.4.160.0090.00916.71
7.4.150.0090.00917.40
7.4.140.0090.00817.86
7.4.130.0080.01316.49
7.4.120.0060.01116.53
7.4.110.0210.00316.41
7.4.100.0150.00616.80
7.4.90.0250.00616.46
7.4.80.0060.02019.39
7.4.70.0120.01216.43
7.4.60.0120.00516.50
7.4.50.0030.00316.67
7.4.40.0100.00222.77
7.4.30.0000.01716.76
7.4.10.0130.00615.00
7.4.00.0050.01014.75
7.3.330.0060.00313.43
7.3.320.0030.00313.19
7.3.310.0030.00316.44
7.3.300.0000.00716.38
7.3.290.0030.01316.29
7.3.280.0100.00516.34
7.3.270.0150.00317.40
7.3.260.0110.00816.39
7.3.250.0100.01316.56
7.3.240.0100.00716.34
7.3.230.0090.01316.48
7.3.210.0070.01016.41
7.3.200.0070.01819.39
7.3.190.0070.01416.38
7.3.180.0060.01016.30
7.3.170.0110.00516.50
7.3.160.0130.00316.29
7.3.130.0030.01414.83
7.3.120.0050.01014.73
7.3.110.0060.01014.65
7.3.100.0140.00014.84
7.3.90.0030.00714.76
7.3.80.0000.01014.86
7.3.70.0030.00714.88
7.3.60.0000.01514.85
7.3.50.0100.00314.91
7.3.40.0090.00014.84
7.3.30.0030.01014.94
7.3.20.0100.00016.86
7.3.10.0040.01216.47
7.3.00.0110.00416.46
7.2.330.0100.00616.86
7.2.320.0150.00716.81
7.2.310.0070.01016.61
7.2.300.0100.01316.39
7.2.290.0120.00416.80
7.2.260.0090.01215.07
7.2.250.0060.01215.28
7.2.240.0000.01515.25
7.2.230.0090.00615.10
7.2.220.0060.01314.87
7.2.210.0120.00315.32
7.2.200.0060.00614.99
7.2.190.0060.00615.01
7.2.180.0090.00615.06
7.2.170.0000.01015.04
7.2.160.0090.00415.11
7.2.150.0030.01416.89
7.2.140.0070.00316.98
7.2.130.0000.01416.99
7.2.120.0060.00916.94
7.2.110.0130.00016.88
7.2.100.0030.01317.02
7.2.90.0040.01116.86
7.2.80.0070.00717.13
7.2.70.0130.00616.75
7.2.60.0000.00917.04
7.2.50.0080.00816.81
7.2.40.0070.00716.89
7.2.30.0150.00317.14
7.2.20.0070.00717.18
7.2.10.0060.00316.95
7.2.00.0050.01318.10
7.1.330.0030.01015.73
7.1.320.0070.00715.67
7.1.310.0060.00916.06
7.1.300.0000.01415.85
7.1.290.0090.00315.83
7.1.280.0070.00415.86
7.1.270.0000.01515.78
7.1.260.0050.00515.50
7.1.250.0000.01315.73
7.1.240.0040.00815.98
7.1.230.0060.00615.86
7.1.220.0030.00715.71
7.1.210.0120.00315.71
7.1.200.0000.01115.72
7.1.190.0070.01115.80
7.1.180.0080.00315.79
7.1.170.0000.01215.74
7.1.160.0070.01115.80
7.1.150.0070.00715.76
7.1.140.0040.00415.66
7.1.130.0040.01015.75
7.1.120.0110.00415.89
7.1.110.0100.00315.92
7.1.100.0060.00916.98
7.1.90.0030.00915.84
7.1.80.0090.00915.79
7.1.70.0020.01116.48
7.1.60.0050.01217.65
7.1.50.0090.00716.29
7.1.40.0070.00715.88
7.1.30.0030.00815.86
7.1.20.0090.00615.79
7.1.10.0040.00815.69
7.1.00.0050.04019.05
7.0.330.0030.01315.59
7.0.320.0040.01115.53
7.0.310.0040.01115.46
7.0.300.0000.01115.43
7.0.290.0070.00715.46
7.0.280.0070.00715.39
7.0.270.0000.00715.48
7.0.260.0040.01115.37
7.0.250.0060.00315.05
7.0.240.0110.00415.25
7.0.230.0090.00615.30
7.0.220.0000.00815.56
7.0.210.0080.00415.50
7.0.200.0050.00515.98
7.0.190.0040.01115.52
7.0.180.0070.00715.30
7.0.170.0030.00615.27
7.0.160.0090.00315.54
7.0.150.0060.00915.47
7.0.140.0050.03818.67
7.0.130.0100.00715.40
7.0.120.0050.00815.17
7.0.110.0060.00615.50
7.0.100.0070.00715.27
7.0.90.0040.00415.50
7.0.80.0000.01215.59
7.0.70.0040.01115.11
7.0.60.0050.03517.73
7.0.50.0030.04616.71
7.0.40.0070.04716.79
7.0.30.0300.02816.69
7.0.20.0150.04716.86
7.0.10.0200.04216.77
7.0.00.0050.03216.85
5.6.400.0080.00414.60
5.6.390.0070.01014.09
5.6.380.0060.00614.39
5.6.370.0000.00914.50
5.6.360.0080.00314.51
5.6.350.0000.01114.62
5.6.340.0040.00414.47
5.6.330.0000.01414.48
5.6.320.0040.00714.54
5.6.310.0040.00814.32
5.6.300.0060.00314.46
5.6.290.0000.01314.56
5.6.280.0070.03717.69
5.6.270.0130.00314.41
5.6.260.0100.00314.13
5.6.250.0000.01314.48
5.6.240.0030.00614.08
5.6.230.0060.00814.54
5.6.220.0070.00714.49
5.6.210.0030.04617.52
5.6.200.0090.04516.39
5.6.190.0070.04717.50
5.6.180.0150.04517.57
5.6.170.0170.02217.49
5.6.160.0050.04617.54
5.6.150.0050.02916.41
5.6.140.0130.03816.21
5.6.130.0020.03016.40
5.6.120.0050.02517.80
5.6.110.0130.03617.80
5.6.100.0030.03017.67
5.6.90.0040.02917.69
5.6.80.0050.03117.23
5.6.70.2170.01817.47
5.6.60.0100.00714.40
5.6.50.0040.00814.47
5.6.40.0000.01414.23
5.6.30.0030.01214.22
5.6.20.0030.00714.24
5.6.10.0070.00714.52
5.6.00.0000.01014.08
5.5.380.0040.00714.46
5.5.370.0070.01114.47
5.5.360.0030.00514.46
5.5.350.0080.04317.37
5.5.340.0070.03216.21
5.5.330.0050.04617.29
5.5.320.0150.02417.18
5.5.310.0170.04217.24
5.5.300.0080.01816.04
5.5.290.0070.04416.15
5.5.280.0100.04017.52
5.5.270.0070.04317.50
5.5.260.0070.04217.39
5.5.250.0080.02517.40
5.5.240.0180.03117.26
5.5.230.0040.01114.39
5.5.220.0030.01514.18
5.5.210.0100.00014.40
5.5.200.0030.00614.11
5.5.190.0030.01014.26
5.5.180.0030.00814.46
5.5.170.0090.00313.97
5.5.160.0030.00714.45
5.5.150.0080.00814.21
5.5.140.0060.00614.39
5.5.130.0060.00614.07
5.5.120.0170.00013.95
5.5.110.0060.00614.21
5.5.100.0030.00714.42
5.5.90.0040.01114.53
5.5.80.0040.01114.16
5.5.70.0060.01014.22
5.5.60.0040.01214.66
5.5.50.0000.00914.38
5.5.40.0100.00614.07
5.5.30.0100.00314.11
5.5.20.0040.00913.90
5.5.10.0120.00414.04
5.5.00.0000.01314.29
5.4.450.0080.03215.34
5.4.440.0130.03015.38
5.4.430.0370.03415.22
5.4.420.0350.03615.28
5.4.410.0480.03015.21
5.4.400.0330.03014.89
5.4.390.0330.03615.21
5.4.380.0200.02514.92
5.4.370.0170.03014.88
5.4.360.0210.02814.78
5.4.350.0180.03214.94
5.4.340.0150.02914.75
5.4.330.0030.00710.98
5.4.320.0040.02511.77
5.4.310.0030.02411.72
5.4.300.0050.02211.89
5.4.290.0060.02011.79
5.4.280.0050.02111.64
5.4.270.0060.02211.85
5.4.260.0040.02311.71
5.4.250.0040.02311.74
5.4.240.0050.02111.85
5.4.230.0020.02311.71
5.4.220.0050.02011.85
5.4.210.0030.02211.73
5.4.200.0030.02311.76
5.4.190.0040.02111.79
5.4.180.0020.02511.64
5.4.170.0040.02311.77
5.4.160.0040.02511.73
5.4.150.0080.02611.69
5.4.140.0050.02411.48
5.4.130.0070.02011.58
5.4.120.0040.02011.41
5.4.110.0060.02111.43
5.4.100.0030.02311.57
5.4.90.0060.02111.62
5.4.80.0020.02511.44
5.4.70.0070.02111.58
5.4.60.0040.02211.62
5.4.50.0050.01911.42
5.4.40.0030.02111.34
5.4.30.0070.02211.57
5.4.20.0060.02111.58
5.4.10.0060.02511.57
5.4.00.0030.02411.22
5.3.290.0080.02311.75
5.3.280.0050.02111.57
5.3.270.0050.02211.65
5.3.260.0080.01911.65
5.3.250.0040.02311.66
5.3.240.0050.03211.61
5.3.230.0080.02111.64
5.3.220.0060.02111.62
5.3.210.0050.02511.64
5.3.200.0060.02511.54
5.3.190.0030.02511.67
5.3.180.0040.02211.71
5.3.170.0020.02411.71
5.3.160.0050.02211.56
5.3.150.0060.02111.73
5.3.140.0040.02311.68
5.3.130.0080.02011.52
5.3.120.0050.02211.64
5.3.110.0080.02011.63
5.3.100.0050.02511.29
5.3.90.0080.02311.28
5.3.80.0080.02011.38
5.3.70.0070.01811.33
5.3.60.0020.02911.26
5.3.50.0050.03211.32
5.3.40.0090.02911.34
5.3.30.0070.02811.19
5.3.20.0100.02411.20
5.3.10.0040.03111.12
5.3.00.0050.03311.08
5.2.170.0090.0459.23
5.2.160.0080.0399.23
5.2.150.0060.0459.23
5.2.140.0080.0459.22
5.2.130.0080.0399.18
5.2.120.0080.0429.18
5.2.110.0070.0419.19
5.2.100.0080.0539.19
5.2.90.0060.0439.19
5.2.80.0070.0409.18
5.2.70.0100.0369.18
5.2.60.0040.0399.13
5.2.50.0070.0409.10
5.2.40.0070.0399.08
5.2.30.0030.0389.06
5.2.20.0030.0329.04
5.2.10.0060.0278.95
5.2.00.0050.0308.81
5.1.60.0030.0258.09
5.1.50.0050.0248.09
5.1.40.0060.0258.08
5.1.30.0050.0268.43
5.1.20.0050.0268.45
5.1.10.0060.0258.17
5.1.00.0040.0308.18
5.0.50.0050.0226.65
5.0.40.0050.0266.51
5.0.30.0060.0336.32
5.0.20.0040.0286.29
5.0.10.0040.0226.27
5.0.00.0050.0296.27
4.4.90.0020.0164.78
4.4.80.0020.0164.75
4.4.70.0040.0164.75
4.4.60.0010.0214.75
4.4.50.0020.0164.77
4.4.40.0060.0284.71
4.4.30.0030.0154.76
4.4.20.0020.0174.84
4.4.10.0020.0174.85
4.4.00.0030.0254.76
4.3.110.0020.0164.66
4.3.100.0040.0144.66
4.3.90.0020.0154.63
4.3.80.0030.0244.58
4.3.70.0030.0144.63
4.3.60.0020.0154.62
4.3.50.0050.0144.63
4.3.40.0010.0264.54
4.3.30.0020.0163.30
4.3.20.0030.0153.28
4.3.10.0030.0153.23
4.3.00.0200.01310.54

preferences:
40.85 ms | 401 KiB | 5 Q