3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* Challenge 1: Modify 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 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 //Instantiate the reflection object $reflector = new ReflectionClass('Test'); //Now get all the properties from class A in to $properties array $properties = $reflector->getProperties(); $i =1; //Now go through the $properties array and populate each property foreach($properties as $property) { //Populating properties $a->{$property->getName()}=$i; //Invoking the method to print what was populated $a->{"echo".ucfirst($property->getName())}()."\n"; $i++; } // 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.70.0030.01518.68
8.3.60.0070.00718.64
8.3.50.0070.01421.08
8.3.40.0200.00018.83
8.3.30.0070.00720.13
8.3.20.0080.00020.30
8.3.10.0030.00522.08
8.3.00.0060.00322.50
8.2.190.0150.00316.58
8.2.180.0150.00318.41
8.2.170.0160.00022.96
8.2.160.0130.00020.47
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0100.01026.16
8.2.120.0080.00417.80
8.2.110.0030.00720.94
8.2.100.0090.00318.03
8.2.90.0050.00319.22
8.2.80.0040.00419.40
8.2.70.0030.00617.72
8.2.60.0060.00317.93
8.2.50.0060.00318.07
8.2.40.0090.00018.03
8.2.30.0080.00017.99
8.2.20.0040.00417.72
8.2.10.0040.00417.83
8.2.00.0030.00517.83
8.1.280.0150.00625.92
8.1.270.0040.00424.66
8.1.260.0030.00626.35
8.1.250.0040.00428.09
8.1.240.0080.00022.05
8.1.230.0080.00418.82
8.1.220.0040.00417.74
8.1.210.0050.00318.77
8.1.200.0030.00617.35
8.1.190.0000.00817.52
8.1.180.0050.00319.14
8.1.170.0000.00918.51
8.1.160.0000.00722.16
8.1.150.0030.00518.66
8.1.140.0000.00717.41
8.1.130.0000.00717.83
8.1.120.0040.00417.39
8.1.110.0020.00517.50
8.1.100.0080.00017.38
8.1.90.0070.00017.52
8.1.80.0000.00717.40
8.1.70.0050.00317.49
8.1.60.0050.00517.60
8.1.50.0070.00017.50
8.1.40.0000.00817.54
8.1.30.0080.00017.69
8.1.20.0030.00517.54
8.1.10.0020.00517.63
8.1.00.0000.00717.48
8.0.300.0070.00018.77
8.0.290.0000.00717.05
8.0.280.0070.00018.46
8.0.270.0030.00517.29
8.0.260.0080.00016.90
8.0.250.0000.00717.03
8.0.240.0030.00517.08
8.0.230.0070.00017.08
8.0.220.0070.00016.99
8.0.210.0040.00417.00
8.0.200.0000.00717.05
8.0.190.0050.00517.04
8.0.180.0040.00416.89
8.0.170.0040.00416.84
8.0.160.0000.00716.99
8.0.150.0050.00316.82
8.0.140.0030.00316.85
8.0.130.0060.00013.50
8.0.120.0050.00317.01
8.0.110.0040.00416.87
8.0.100.0000.00716.75
8.0.90.0050.00216.86
8.0.80.0090.00916.86
8.0.70.0040.00417.02
8.0.60.0070.00016.87
8.0.50.0000.00817.04
8.0.30.0080.01416.95
8.0.20.0040.01417.40
8.0.10.0070.00016.95
8.0.00.0160.00616.81
7.4.330.0000.00515.00
7.4.320.0060.00016.62
7.4.300.0030.00316.54
7.4.290.0040.00416.63
7.4.280.0070.00016.41
7.4.270.0000.00816.61
7.4.260.0030.00316.48
7.4.250.0000.00816.58
7.4.240.0040.00316.49
7.4.230.0030.00316.52
7.4.220.0130.00316.71
7.4.210.0070.00916.58
7.4.200.0030.00316.50
7.4.190.0030.00316.76
7.4.160.0070.01116.45
7.4.150.0090.00917.40
7.4.140.0130.00617.86
7.4.130.0090.00916.68
7.4.120.0050.01216.50
7.4.110.0070.01016.54
7.4.100.0180.00016.55
7.4.90.0030.01416.62
7.4.80.0070.01119.39
7.4.70.0020.01416.54
7.4.60.0100.01316.48
7.4.50.0000.00516.39
7.4.40.0070.01022.77
7.4.30.0160.00316.45
7.4.00.0100.00514.95
7.3.330.0020.00213.17
7.3.320.0000.00513.25
7.3.310.0030.00316.35
7.3.300.0000.00716.29
7.3.290.0070.00716.35
7.3.280.0050.01116.33
7.3.270.0120.01217.40
7.3.260.0140.00616.71
7.3.250.0120.00616.63
7.3.240.0100.01016.56
7.3.230.0140.00516.43
7.3.210.0070.01116.52
7.3.200.0110.00519.39
7.3.190.0090.00916.36
7.3.180.0100.00716.27
7.3.170.0120.00316.44
7.3.160.0130.00816.39
7.3.120.0100.00514.81
7.3.110.0140.00414.91
7.3.100.0040.01114.71
7.3.90.0130.00314.68
7.3.80.0040.01214.95
7.3.70.0040.00814.86
7.3.60.0130.00014.74
7.3.50.0040.00714.96
7.3.40.0030.01014.66
7.3.30.0070.01014.95
7.3.20.0040.01416.59
7.3.10.0070.00816.77
7.3.00.0050.00716.65
7.2.330.0120.00816.54
7.2.320.0080.00816.83
7.2.310.0140.00316.88
7.2.300.0130.00316.84
7.2.290.0100.00616.60
7.2.250.0030.01615.09
7.2.240.0110.00815.04
7.2.230.0070.00715.00
7.2.220.0070.01015.25
7.2.210.0070.01014.76
7.2.200.0060.01015.01
7.2.190.0100.00314.89
7.2.180.0060.00615.04
7.2.170.0000.01715.20
7.2.130.0110.00716.81
7.2.120.0140.00316.71
7.2.110.0040.00916.69
7.2.100.0040.01116.96
7.2.90.0040.00716.95
7.2.80.0030.01216.88
7.2.70.0110.00716.96
7.2.60.0070.01016.86
7.2.50.0100.00716.88
7.2.40.0100.00717.07
7.2.30.0070.00716.71
7.2.20.0060.01316.87
7.2.10.0090.00616.64
7.2.00.0040.00818.26
7.1.330.0110.00415.87
7.1.320.0040.00815.92
7.1.310.0060.00615.71
7.1.300.0070.01015.72
7.1.290.0090.00315.86
7.1.280.0070.00715.57
7.1.270.0070.01115.88
7.1.260.0040.00815.59
7.1.250.0070.00315.77
7.1.200.0000.01215.57
7.1.100.0040.00718.23
7.1.70.0030.00517.19
7.1.60.0090.01619.43
7.1.50.0100.01016.88
7.1.00.0000.06722.30
7.0.200.0090.00016.77
7.0.140.0070.07021.92
7.0.110.0130.07319.86
7.0.100.0070.07719.96
7.0.90.0170.04019.93
7.0.80.0070.04020.04
7.0.70.0030.05019.85
7.0.60.0070.03319.94
7.0.50.0130.07319.88
7.0.40.0030.06719.71
7.0.30.0130.02719.85
7.0.20.0030.07019.69
7.0.10.0030.03719.81
7.0.00.0100.03719.71
5.6.280.0030.07321.08
5.6.260.0030.03320.63
5.6.250.0030.06020.75
5.6.240.0030.04320.70
5.6.230.0070.06320.70
5.6.220.0070.04020.71
5.6.210.0130.07020.61
5.6.200.0030.03720.62
5.6.190.0030.07720.69
5.6.180.0000.05020.65
5.6.170.0100.06320.66
5.6.160.0000.06320.63
5.6.150.0030.03720.63
5.6.140.0030.05320.62
5.6.130.0030.04320.70
5.6.120.0030.06720.57
5.6.110.0030.04720.68
5.6.100.0000.04020.61
5.6.90.0000.04320.54
5.6.80.0030.04719.95
5.6.70.0070.07719.93
5.6.60.0130.05320.20
5.6.50.0030.06720.03
5.6.40.0030.08719.98
5.6.30.0000.05319.83
5.6.20.0070.04719.97
5.6.10.0170.06320.07
5.6.00.0100.05720.00
5.5.380.0070.07317.52
5.5.370.0170.04717.72
5.5.360.0130.03317.68
5.5.350.0070.05717.55
5.5.340.0030.07718.12
5.5.330.0070.08018.07
5.5.320.0070.06718.23
5.5.310.0070.07017.93
5.5.300.0000.07718.04
5.5.290.0000.03717.93
5.5.280.0070.04717.93
5.5.270.0070.03317.90
5.5.260.0000.04717.94
5.5.250.0030.04017.72
5.5.240.0070.03717.30
5.5.230.0030.06717.61
5.5.220.0170.06017.47
5.5.210.0030.03717.30
5.5.200.0030.04317.49
5.5.190.0000.04717.58
5.5.180.0070.04017.48
5.5.160.0030.05017.28
5.5.150.0000.05017.46
5.5.140.0030.07317.28
5.5.130.0030.04017.57
5.5.120.0030.05017.42
5.5.110.0070.07017.17
5.5.100.0030.04317.18
5.5.90.0030.04017.31
5.5.80.0030.07017.30
5.5.70.0100.03717.20
5.5.60.0070.05717.36
5.5.50.0070.05017.20
5.5.40.0070.06717.31
5.5.30.0070.04017.46
5.5.20.0100.07717.49
5.5.10.0030.04317.29
5.5.00.0030.05017.43
5.4.450.0000.04319.49
5.4.440.0000.05319.66
5.4.430.0030.05319.34
5.4.420.0000.04319.27
5.4.410.0100.02719.17
5.4.400.0070.07318.98
5.4.390.0070.03019.01
5.4.380.0100.03019.01
5.4.370.0070.05019.09
5.4.360.0200.06719.16
5.4.350.0170.07019.34
5.4.340.0070.03719.16
5.4.320.0070.08019.32
5.4.310.0070.04019.34
5.4.300.0070.07719.00
5.4.290.0100.03318.99
5.4.280.0030.06719.01
5.4.270.0000.08019.24
5.4.260.0170.03719.23
5.4.250.0070.05719.16
5.4.240.0100.06019.00
5.4.230.0070.08019.23
5.4.220.0070.06319.31
5.4.210.0000.05319.08
5.4.200.0100.04319.33
5.4.190.0070.05018.94
5.4.180.0030.09318.97
5.4.170.0070.04018.97
5.4.160.0070.05719.06
5.4.150.0070.03719.12
5.4.140.0070.06716.33
5.4.130.0070.07316.35
5.4.120.0070.05316.35
5.4.110.0000.06316.59
5.4.100.0070.07716.53
5.4.90.0070.04716.51
5.4.80.0070.06016.46
5.4.70.0030.04016.50
5.4.60.0030.04316.53
5.4.50.0030.03716.56
5.4.40.0030.03716.61
5.4.30.0070.03716.48
5.4.20.0030.04016.52
5.4.10.0030.04016.41
5.4.00.0030.03715.97
5.3.290.0100.07314.64
5.3.280.0070.03714.61
5.3.270.0130.06014.62
5.3.260.0000.04314.46
5.3.250.0100.03014.63
5.3.240.0070.07014.46
5.3.230.0100.07014.60
5.3.220.0030.04714.57
5.3.210.0030.07714.58
5.3.200.0130.03714.59
5.3.190.0030.06314.59
5.3.180.0030.04014.56
5.3.170.0030.07014.65
5.3.160.0130.05714.58
5.3.150.0030.03714.57
5.3.140.0000.04014.57
5.3.130.0030.04014.69
5.3.120.0130.03714.68
5.3.110.0030.04314.70
5.3.100.0000.04013.91
5.3.90.0000.04314.05
5.3.80.0070.03313.88
5.3.70.0000.04014.16
5.3.60.0100.03314.00
5.3.50.0030.03013.93
5.3.40.0100.03313.95
5.3.30.0000.03713.89
5.3.20.0100.05713.80
5.3.10.0070.02713.89
5.3.00.0030.03313.65
5.2.170.0100.05011.93
5.2.160.0030.02711.93
5.2.150.0030.03011.93
5.2.140.0000.03011.93
5.2.130.0070.03011.93
5.2.120.0070.02711.93
5.2.110.0030.03011.93
5.2.100.0000.03711.93
5.2.90.0070.03711.93
5.2.80.0000.04011.93
5.2.70.0070.02711.93
5.2.60.0030.04011.93
5.2.50.0070.04011.93
5.2.40.0030.05011.93
5.2.30.0030.05311.93
5.2.20.0000.03711.93
5.2.10.0000.05311.93
5.2.00.0000.03311.93
5.1.60.0030.02311.93
5.1.50.0070.02311.93
5.1.40.0070.05011.93
5.1.30.0030.03711.93
5.1.20.0000.02311.93
5.1.10.0030.02011.93
5.1.00.0070.02311.93
5.0.50.0030.01711.93
5.0.40.0000.03311.93
5.0.30.0000.06011.93
5.0.20.0000.02311.93
5.0.10.0000.02011.93
5.0.00.0030.03011.93
4.4.90.0000.01311.93
4.4.80.0000.01311.93
4.4.70.0000.01711.93
4.4.60.0030.03311.93
4.4.50.0000.02311.93
4.4.40.0030.03011.93
4.4.30.0030.01311.93
4.4.20.0000.01711.93
4.4.10.0030.04311.93
4.4.00.0000.02711.93
4.3.110.0030.01011.93
4.3.100.0030.03011.93
4.3.90.0000.02711.93
4.3.80.0000.05311.93
4.3.70.0000.01711.93
4.3.60.0000.03311.93
4.3.50.0000.01711.93
4.3.40.0030.02011.93
4.3.30.0000.01711.93
4.3.20.0000.01711.93
4.3.10.0000.01711.93
4.3.00.0000.01311.93

preferences:
37.13 ms | 401 KiB | 5 Q