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"]); 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.0120.00316.75
8.3.50.0080.00921.98
8.3.40.0100.00719.00
8.3.30.0110.00419.07
8.3.20.0000.00720.39
8.3.10.0050.00323.56
8.3.00.0040.00419.38
8.2.180.0110.01118.29
8.2.170.0120.00322.96
8.2.160.0070.00719.09
8.2.150.0080.00024.18
8.2.140.0090.00624.66
8.2.130.0070.00026.16
8.2.120.0000.00822.30
8.2.110.0030.00622.26
8.2.100.0090.00317.76
8.2.90.0090.00019.36
8.2.80.0000.00817.97
8.2.70.0000.00817.63
8.2.60.0080.00018.05
8.2.50.0060.00618.07
8.2.40.0060.00319.97
8.2.30.0030.00818.28
8.2.20.0000.00817.82
8.2.10.0040.00418.07
8.2.00.0040.00417.85
8.1.280.0150.00025.92
8.1.270.0080.00022.05
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0030.00723.96
8.1.230.0030.00918.97
8.1.220.0080.00017.76
8.1.210.0050.00518.77
8.1.200.0040.00417.48
8.1.190.0030.00617.53
8.1.180.0080.00018.10
8.1.170.0040.00418.55
8.1.160.0040.00422.02
8.1.150.0090.00018.62
8.1.140.0070.00017.50
8.1.130.0000.00717.75
8.1.120.0000.00817.39
8.1.110.0110.00017.46
8.1.100.0030.00317.52
8.1.90.0040.00417.36
8.1.80.0030.00317.37
8.1.70.0000.00717.35
8.1.60.0030.00517.49
8.1.50.0000.00817.55
8.1.40.0040.00417.51
8.1.30.0080.00017.52
8.1.20.0030.00517.61
8.1.10.0060.00317.60
8.1.00.0040.00417.54
8.0.300.0040.00419.15
8.0.290.0040.00417.18
8.0.280.0070.00018.48
8.0.270.0070.00017.28
8.0.260.0030.00317.18
8.0.250.0030.00316.95
8.0.240.0040.00417.05
8.0.230.0000.00917.07
8.0.220.0000.00716.96
8.0.210.0030.00616.88
8.0.200.0070.00016.92
8.0.190.0000.00716.99
8.0.180.0000.01017.00
8.0.170.0060.00316.89
8.0.160.0050.00216.91
8.0.150.0040.00416.80
8.0.140.0030.00516.89
8.0.130.0000.00613.44
8.0.120.0060.00316.91
8.0.110.0000.00716.94
8.0.100.0040.00416.80
8.0.90.0000.00716.82
8.0.80.0060.01216.93
8.0.70.0040.00416.82
8.0.60.0030.00517.03
8.0.50.0030.00617.08
8.0.30.0060.01417.23
8.0.20.0090.01117.42
8.0.10.0050.00317.06
8.0.00.0100.00716.63
7.4.330.0000.00515.00
7.4.320.0050.00316.61
7.4.300.0000.00616.58
7.4.290.0000.00716.43
7.4.280.0040.00416.65
7.4.270.0000.00816.59
7.4.260.0030.00316.56
7.4.250.0030.00516.45
7.4.240.0030.00316.60
7.4.230.0030.00316.50
7.4.220.0110.00716.48
7.4.210.0060.01016.63
7.4.200.0060.00316.63
7.4.190.0000.00716.70
7.4.160.0060.01016.59
7.4.150.0160.00617.40
7.4.140.0120.00817.86
7.4.130.0080.00916.53
7.4.120.0090.00816.50
7.4.110.0030.01416.67
7.4.100.0150.00316.53
7.4.90.0110.01116.40
7.4.80.0130.00619.39
7.4.70.0050.01116.48
7.4.60.0090.01116.45
7.4.50.0050.00016.47
7.4.40.0070.00722.77
7.4.30.0070.01016.67
7.4.00.0060.00915.01
7.3.330.0060.00013.39
7.3.320.0000.00513.39
7.3.310.0050.00316.45
7.3.300.0070.00016.47
7.3.290.0040.01216.35
7.3.280.0120.00816.34
7.3.270.0090.00917.40
7.3.260.0030.01516.49
7.3.250.0080.00916.38
7.3.240.0120.00516.46
7.3.230.0110.00616.39
7.3.210.0100.00716.73
7.3.200.0070.01019.39
7.3.190.0080.00816.30
7.3.180.0110.00416.44
7.3.170.0060.01016.44
7.3.160.0070.01016.59
7.3.120.0080.00914.84
7.3.110.0110.00715.09
7.3.100.0090.00614.79
7.3.90.0070.00714.91
7.3.80.0040.01114.78
7.3.70.0030.01014.67
7.3.60.0030.00714.90
7.3.50.0120.00314.79
7.3.40.0090.00014.79
7.3.30.0030.00914.66
7.3.20.0030.00916.85
7.3.10.0110.00616.41
7.3.00.0060.00716.60
7.2.330.0070.01016.79
7.2.320.0070.01116.68
7.2.310.0100.00716.75
7.2.300.0100.00716.44
7.2.290.0130.00716.80
7.2.250.0060.01314.90
7.2.240.0100.01014.82
7.2.230.0060.00815.07
7.2.220.0070.01015.09
7.2.210.0100.01015.23
7.2.200.0060.00915.14
7.2.190.0040.01215.21
7.2.180.0000.01215.02
7.2.170.0070.00715.08
7.2.160.0000.01415.11
7.2.150.0060.00917.02
7.2.140.0110.00016.91
7.2.130.0060.00816.66
7.2.120.0080.00716.60
7.2.110.0100.00616.66
7.2.100.0100.00716.79
7.2.90.0100.01116.87
7.2.80.0110.00516.72
7.2.70.0080.01016.66
7.2.60.0080.00816.90
7.2.50.0080.00716.92
7.2.40.0080.00816.86
7.2.30.0080.00716.76
7.2.20.0130.00616.60
7.2.10.0110.00616.67
7.2.00.0090.00717.60
7.1.330.0040.01215.94
7.1.320.0030.01415.70
7.1.310.0100.00315.98
7.1.300.0000.01315.88
7.1.290.0070.00715.83
7.1.280.0070.00715.81
7.1.270.0060.00615.84
7.1.260.0080.00415.60
7.1.250.0060.00715.60
7.1.240.0030.00915.75
7.1.230.0100.00015.93
7.1.220.0030.01015.96
7.1.210.0040.00715.72
7.1.200.0030.01015.86
7.1.190.0070.00715.68
7.1.180.0080.00515.69
7.1.170.0030.01015.77
7.1.160.0040.00815.79
7.1.150.0030.00915.96
7.1.140.0080.00415.83
7.1.130.0040.01215.82
7.1.120.0030.01115.96
7.1.110.0110.00015.93
7.1.100.0110.00416.88
7.1.90.0040.00815.90
7.1.80.0000.01215.91
7.1.70.0080.00516.49
7.1.60.0110.00717.68
7.1.50.0050.01116.31
7.1.40.0030.01315.91
7.1.30.0030.00915.54
7.1.20.0030.00915.77
7.1.10.0040.01115.86
7.1.00.0040.04419.04
7.0.330.0090.00315.54
7.0.320.0040.00415.43
7.0.310.0000.01315.48
7.0.300.0070.00415.43
7.0.290.0070.00715.48
7.0.280.0040.01115.60
7.0.270.0090.00615.57
7.0.260.0160.00015.36
7.0.250.0070.00415.23
7.0.240.0090.00615.58
7.0.230.0030.01115.48
7.0.220.0030.00915.38
7.0.210.0040.00815.49
7.0.200.0080.00516.08
7.0.190.0100.00015.29
7.0.180.0070.00715.29
7.0.170.0000.01415.57
7.0.160.0060.00615.32
7.0.150.0070.00315.59
7.0.140.0050.04818.92
7.0.130.0060.00915.52
7.0.120.0040.00715.50
7.0.110.0030.01015.57
7.0.100.0030.00615.60
7.0.90.0070.00715.24
7.0.80.0060.00915.24
7.0.70.0030.01015.36
7.0.60.0130.03617.61
7.0.50.0050.02516.65
7.0.40.0080.04516.72
7.0.30.0180.02116.80
7.0.20.0180.04216.76
7.0.10.0090.02316.62
7.0.00.0100.02516.80
5.6.400.0080.00414.59
5.6.390.0030.00614.70
5.6.380.0080.00014.54
5.6.370.0110.00014.18
5.6.360.0120.00314.15
5.6.350.0000.01514.54
5.6.340.0090.00614.09
5.6.330.0060.00914.55
5.6.320.0030.00914.41
5.6.310.0060.00614.39
5.6.300.0030.01014.59
5.6.290.0060.00614.23
5.6.280.0030.04217.63
5.6.270.0070.00714.71
5.6.260.0070.00314.32
5.6.250.0070.00714.64
5.6.240.0090.00614.36
5.6.230.0100.00014.37
5.6.220.0030.01314.37
5.6.210.0070.03717.52
5.6.200.0030.03816.37
5.6.190.0050.02617.42
5.6.180.0120.03717.46
5.6.170.0250.01817.40
5.6.160.0050.02717.38
5.6.150.0050.03016.21
5.6.140.0070.04916.20
5.6.130.0050.04416.51
5.6.120.0060.04117.71
5.6.110.0030.02417.71
5.6.100.0070.02817.71
5.6.90.0050.02317.62
5.6.80.0070.04117.45
5.6.70.2330.01717.36
5.6.60.0070.00714.00
5.6.50.0030.01214.51
5.6.40.0030.00714.52
5.6.30.0040.01214.18
5.6.20.0080.00614.67
5.6.10.0000.01114.20
5.6.00.0080.00614.25
5.5.380.0030.00714.41
5.5.370.0030.00614.33
5.5.360.0060.00914.52
5.5.350.0070.04617.41
5.5.340.0100.04016.31
5.5.330.0050.02917.29
5.5.320.0140.03717.35
5.5.310.0120.02717.31
5.5.300.0120.04016.13
5.5.290.0020.02716.30
5.5.280.0070.04617.52
5.5.270.0070.03717.69
5.5.260.0080.03617.62
5.5.250.0090.03217.51
5.5.240.0150.04117.12
5.5.230.0080.00814.39
5.5.220.0070.00314.39
5.5.210.0090.00614.35
5.5.200.0040.00714.50
5.5.190.0130.00314.45
5.5.180.0000.00914.14
5.5.170.0000.01214.34
5.5.160.0060.00614.45
5.5.150.0070.00714.14
5.5.140.0030.01314.47
5.5.130.0060.00914.08
5.5.120.0080.00414.49
5.5.110.0100.00714.42
5.5.100.0040.01214.27
5.5.90.0100.00714.38
5.5.80.0040.01114.32
5.5.70.0070.00713.90
5.5.60.0100.00714.09
5.5.50.0040.01214.43
5.5.40.0070.01014.34
5.5.30.0130.00314.55
5.5.20.0070.01014.45
5.5.10.0000.01314.03
5.5.00.0060.00314.57
5.4.450.0500.03515.21
5.4.440.0490.03015.34
5.4.430.0370.03415.46
5.4.420.0460.04015.28
5.4.410.0370.03415.16
5.4.400.0370.02815.21
5.4.390.0100.03514.83
5.4.380.0240.03814.92
5.4.370.0170.03714.94
5.4.360.0270.03914.96
5.4.350.0200.02315.02
5.4.340.0190.03515.03
5.4.330.0130.00711.18
5.4.320.0080.02511.81
5.4.310.0090.02011.66
5.4.300.0090.02211.92
5.4.290.0120.01811.80
5.4.280.0050.02411.77
5.4.270.0070.02111.76
5.4.260.0070.02311.70
5.4.250.0060.02211.61
5.4.240.0050.02311.82
5.4.230.0070.02311.83
5.4.220.0110.02711.83
5.4.210.0100.03011.71
5.4.200.0080.03011.60
5.4.190.0110.02711.69
5.4.180.0090.02111.69
5.4.170.0070.02111.83
5.4.160.0080.02211.64
5.4.150.0100.02211.85
5.4.140.0100.02711.73
5.4.130.0050.02511.58
5.4.120.0110.02211.65
5.4.110.0090.02111.44
5.4.100.0080.02111.58
5.4.90.0130.01911.61
5.4.80.0100.02511.58
5.4.70.0080.02811.62
5.4.60.0080.02611.64
5.4.50.0130.01811.54
5.4.40.0120.01711.55
5.4.30.0080.02111.47
5.4.20.0070.02111.47
5.4.10.0090.01811.59
5.4.00.0060.02111.43
5.3.290.0060.02511.63
5.3.280.0090.01911.63
5.3.270.0070.02511.69
5.3.260.0090.02111.70
5.3.250.0120.02011.73
5.3.240.0070.02511.46
5.3.230.0100.02111.53
5.3.220.0070.02511.60
5.3.210.0080.02311.55
5.3.200.0100.02011.60
5.3.190.0080.02111.50
5.3.180.0100.01911.73
5.3.170.0050.02511.71
5.3.160.0110.01911.77
5.3.150.0050.02311.71
5.3.140.0070.02111.73
5.3.130.0060.02511.67
5.3.120.0080.02311.63
5.3.110.0120.02011.69
5.3.100.0070.02211.38
5.3.90.0070.02011.38
5.3.80.0060.02011.39
5.3.70.0070.02211.34
5.3.60.0090.02111.33
5.3.50.0070.02311.28
5.3.40.0100.02311.35
5.3.30.0130.01911.29
5.3.20.0080.02711.17
5.3.10.0090.02711.10
5.3.00.0100.03310.94
5.2.170.0060.0489.23
5.2.160.0090.0449.23
5.2.150.0060.0399.23
5.2.140.0030.0369.23
5.2.130.0050.0289.19
5.2.120.0030.0309.18
5.2.110.0070.0279.19
5.2.100.0050.0299.19
5.2.90.0040.0449.19
5.2.80.0080.0449.18
5.2.70.0050.0369.18
5.2.60.0050.0299.13
5.2.50.0050.0299.11
5.2.40.0040.0289.09
5.2.30.0050.0289.05
5.2.20.0060.0269.04
5.2.10.0040.0288.95
5.2.00.0030.0308.82
5.1.60.0030.0258.10
5.1.50.0020.0278.09
5.1.40.0030.0258.07
5.1.30.0040.0268.42
5.1.20.0070.0238.45
5.1.10.0040.0268.18
5.1.00.0040.0268.17
5.0.50.0050.0296.65
5.0.40.0020.0266.52
5.0.30.0070.0416.32
5.0.20.0020.0296.29
5.0.10.0040.0246.27
5.0.00.0040.0336.26
4.4.90.0020.0194.78
4.4.80.0060.0154.75
4.4.70.0050.0174.75
4.4.60.0070.0144.75
4.4.50.0030.0234.77
4.4.40.0030.0354.70
4.4.30.0030.0224.76
4.4.20.0040.0234.84
4.4.10.0040.0244.85
4.4.00.0030.0344.76
4.3.110.0040.0234.67
4.3.100.0050.0204.66
4.3.90.0020.0234.63
4.3.80.0030.0324.59
4.3.70.0020.0164.63
4.3.60.0040.0214.63
4.3.50.0040.0224.63
4.3.40.0020.0274.53
4.3.30.0040.0153.30
4.3.20.0020.0173.28
4.3.10.0020.0193.24
4.3.00.0000.01313.47

preferences:
34.74 ms | 401 KiB | 5 Q