3v4l.org

run code in 300+ PHP versions simultaneously
<?php class CommandFactory { private $commandMappings; public function __construct(string $mappingFilename = 'default.json') { //$mappingsJSON = file_get_content($mappingFilename); $this->commandMappings = json_decode("{ 'command' : { 'SYSTEMS' : { 'OS1' : { 'Version' : 'command string', 'Version2' : 'command string', }, 'OS2' : { 'Version' : 'command string', 'Version' : 'command string' }, 'COMMANDOPTIONS' : ['var1', 'var2', 'var3'], }, 'add-Firewall' : { 'SYSTEMS' : { 'Ubuntu' : { '14' : 'command string', '11' : 'command string', }, 'Redhat' : { '13' : 'command string', '11' : 'command string' }, 'COMMANDOPTIONS' : ['port',], }, }", true); var_dump($this->commandMappings); } public function getCommand(string $command, array $options): Command { $commandArray = $this->commandMappings[$command]; return new Command($commandArray, $options); } } class Command { private $options; private $mapping; public function __construct($mappings, $options) { var_dump($mappings); //$this->$options = $options; //$this->mapping = $mappings; // check if options are are valid // potentially map in options here? } public function view(string $os, $version): string { // validate $os and $version //$command = $this->mapping['SYSTEMS'][$os][$version]; //$command = str_replace(array_keys($options), $options, $command); return "je;;"; } } // usage $factory = new CommandFactory(); $firewallCommand = $factory->getCommand('add-Firewall', ['port' => 23]); echo $firewallCommand->view('Ubuntu', '11');

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.0060.01316.63
8.3.50.0110.00416.50
8.3.40.0110.00318.80
8.3.30.0040.01118.53
8.3.20.0040.00420.20
8.3.10.0000.00823.48
8.3.00.0080.00022.04
8.2.180.0120.00316.50
8.2.170.0000.01522.96
8.2.160.0000.01419.27
8.2.150.0030.00624.18
8.2.140.0080.00024.66
8.2.130.0090.00021.06
8.2.120.0040.00426.35
8.2.110.0060.00319.23
8.2.100.0000.01117.91
8.2.90.0040.00419.17
8.2.80.0040.00417.97
8.2.70.0030.00517.63
8.2.60.0040.00417.93
8.2.50.0040.00418.10
8.2.40.0030.00620.55
8.2.30.0030.00521.15
8.2.20.0040.00418.19
8.2.10.0030.00517.99
8.2.00.0040.00418.05
8.1.280.0040.01125.92
8.1.270.0000.00722.02
8.1.260.0060.00326.35
8.1.250.0040.00428.09
8.1.240.0000.01022.00
8.1.230.0040.00821.00
8.1.220.0080.00017.79
8.1.210.0040.00418.77
8.1.200.0060.00317.38
8.1.190.0000.00817.10
8.1.180.0000.00818.10
8.1.170.0000.00918.96
8.1.160.0030.00319.06
8.1.150.0040.00418.79
8.1.140.0070.00319.43
8.1.130.0070.00018.77
8.1.120.0080.00017.48
8.1.110.0000.00717.31
8.1.100.0040.00417.34
8.1.90.0030.00517.41
8.1.80.0040.00417.40
8.1.70.0080.00017.41
8.1.60.0040.00417.48
8.1.50.0030.00617.48
8.1.40.0030.00517.51
8.1.30.0000.00817.70
8.1.20.0040.00417.63
8.1.10.0040.00417.66
8.1.00.0060.00317.48
8.0.300.0050.00220.07
8.0.290.0000.00816.63
8.0.280.0000.00718.45
8.0.270.0050.00217.22
8.0.260.0030.00316.79
8.0.250.0030.00317.05
8.0.240.0070.00017.05
8.0.230.0030.00316.86
8.0.220.0000.00716.90
8.0.210.0000.00716.79
8.0.200.0030.00316.98
8.0.190.0040.00417.00
8.0.180.0100.00016.90
8.0.170.0000.00816.91
8.0.160.0000.00716.94
8.0.150.0040.00416.73
8.0.140.0040.00316.83
8.0.130.0030.00313.37
8.0.120.0080.00016.72
8.0.110.0000.00716.96
8.0.100.0040.00416.92
8.0.90.0040.00416.87
8.0.80.0090.00916.86
8.0.70.0050.00316.79
8.0.60.0080.00016.73
8.0.50.0000.00816.80
8.0.30.0040.01517.04
8.0.20.0090.01017.41
8.0.10.0040.00416.82
8.0.00.0170.00016.84
7.4.330.0000.00615.55
7.4.320.0030.00316.49
7.4.300.0060.00016.54
7.4.290.0000.00816.64
7.4.280.0000.00716.64
7.4.270.0000.00716.50
7.4.260.0030.00316.51
7.4.250.0030.00516.55
7.4.240.0070.00016.65
7.4.230.0030.00616.58
7.4.220.0090.01216.63
7.4.210.0070.00816.59
7.4.200.0070.00016.60
7.4.160.0100.00716.46
7.4.150.0110.00717.40
7.4.140.0110.00917.86
7.4.130.0030.01516.49
7.4.120.0100.00916.65
7.4.110.0160.00016.44
7.4.100.0140.00316.62
7.4.90.0140.00216.53
7.4.80.0060.00919.39
7.4.70.0110.00516.46
7.4.60.0100.00616.48
7.4.50.0050.00816.34
7.4.40.0240.01516.50
7.4.30.0150.00416.56
7.4.10.0000.01514.94
7.4.00.0110.00514.99
7.3.330.0000.00613.38
7.3.320.0060.00013.33
7.3.310.0000.00616.24
7.3.300.0060.00016.37
7.3.290.0000.00816.29
7.3.280.0080.01016.35
7.3.270.0060.01217.40
7.3.260.0130.00616.48
7.3.250.0140.00716.46
7.3.240.0100.00716.29
7.3.230.0050.01416.27
7.3.210.0070.00916.45
7.3.200.0150.00616.57
7.3.190.0070.01016.26
7.3.180.0100.00616.47
7.3.170.0100.00716.29
7.3.160.0090.01316.38
7.3.130.0120.00614.63
7.3.120.0080.00914.80
7.3.110.0080.01014.60
7.3.100.0080.00814.69
7.3.90.0020.01314.83
7.3.80.0100.00715.00
7.3.70.0060.00414.87
7.3.60.0030.01214.67
7.3.50.0070.00614.75
7.3.40.0010.00814.55
7.3.30.0030.01114.65
7.3.20.0060.00816.65
7.3.10.0060.00616.68
7.3.00.0050.00716.61
7.2.330.0160.00316.63
7.2.320.0130.00316.48
7.2.310.0060.01516.79
7.2.300.0080.00816.35
7.2.290.0130.00316.59
7.2.260.0100.01015.37
7.2.250.0100.00814.87
7.2.240.0050.01215.12
7.2.230.0090.00414.92
7.2.220.0030.01415.09
7.2.210.0050.01014.93
7.2.200.0020.01314.98
7.2.190.0050.00915.01
7.2.180.0060.01015.08
7.2.170.0040.00815.07
7.2.160.0040.01115.12
7.2.150.0090.00616.98
7.2.140.0030.00917.07
7.2.130.0050.00916.96
7.2.120.0080.00516.97
7.2.110.0060.00916.97
7.2.100.0090.00316.83
7.2.90.0040.00716.90
7.2.80.0070.00616.90
7.2.70.0070.00716.92
7.2.60.0040.00917.00
7.2.50.0050.00716.80
7.2.40.0030.01016.95
7.2.30.0060.00816.88
7.2.20.0040.00716.87
7.2.10.0060.00816.81
7.2.00.0060.00717.60
7.1.330.0140.00015.88
7.1.320.0100.00415.61
7.1.310.0030.01015.84
7.1.300.0020.00815.85
7.1.290.0080.00415.88
7.1.280.0080.00515.77
7.1.270.0060.00815.84
7.1.260.0030.01015.78
7.1.250.0030.00715.81
7.1.240.0070.00415.71
7.1.230.0040.00415.61
7.1.220.0040.00415.80
7.1.210.0040.01115.99
7.1.200.0080.00515.55
7.1.190.0030.00915.59
7.1.180.0000.01215.79
7.1.170.0040.01115.86
7.1.160.0070.00415.95
7.1.150.0110.00415.70
7.1.140.0050.00315.91
7.1.130.0000.01315.85
7.1.120.0070.00715.94
7.1.110.0060.00315.85
7.1.100.0070.00516.87
7.1.90.0110.00415.60
7.1.80.0060.00615.72
7.1.70.0030.01216.38
7.1.60.0190.01125.41
7.1.50.0140.01125.18
7.1.40.0200.00825.09
7.1.30.0140.01625.06
7.1.20.0240.01224.26
7.1.10.0060.01016.21
7.1.00.0060.00916.23
7.0.330.0000.00815.08
7.0.320.0100.00315.48
7.0.310.0090.00015.29
7.0.300.0000.00815.18
7.0.290.0070.00315.21
7.0.280.0060.00615.19
7.0.270.0030.01215.23
7.0.260.0060.00815.42
7.0.250.0070.00315.54
7.0.240.0080.00615.43
7.0.230.0060.00615.46
7.0.220.0030.00615.46
7.0.210.0040.00715.42
7.0.200.0050.01216.07
7.0.190.0060.00815.98
7.0.180.0060.00815.83
7.0.170.0050.01215.99
7.0.160.0090.00915.67
7.0.150.0040.01215.85
7.0.140.0070.00815.82
7.0.130.0030.01116.04
7.0.120.0070.00715.92
7.0.110.0050.01115.89
7.0.100.0100.00615.88
7.0.90.0070.00915.97
7.0.80.0080.00615.82
7.0.70.0060.00915.83
7.0.60.0060.01015.87
7.0.50.0080.00715.90
7.0.40.0130.00415.05
7.0.30.0070.00614.91
7.0.20.0070.01014.91
7.0.10.0030.01414.92
7.0.00.0060.01014.96
5.6.400.0070.00714.32
5.6.390.0030.00714.27
5.6.380.0060.00614.06
5.6.370.0090.00614.21
5.6.360.0100.00314.19
5.6.350.0070.00714.02
5.6.340.0030.00914.30
5.6.330.0140.00014.05
5.6.320.0000.01014.04
5.6.310.0030.01014.11
5.6.300.0000.01013.83
5.6.290.0000.01414.02
5.6.280.0070.00714.10
5.6.270.0060.00614.08
5.6.260.0030.01214.28
5.6.250.0040.00714.20
5.6.240.0060.00614.21
5.6.230.0030.01414.15
5.6.220.0030.00714.31
5.6.210.0050.00513.84
5.6.200.0080.00514.03
5.6.190.0130.00014.07
5.6.180.0000.01114.24
5.6.170.0080.00414.25
5.6.160.0030.01014.05
5.6.150.0040.00414.06
5.6.140.0070.01014.25
5.6.130.0070.00714.13
5.6.120.0040.00713.86
5.6.110.0060.00614.16
5.6.100.0090.00614.20
5.6.90.0110.00314.23
5.6.80.0040.00414.16
5.6.70.0000.01513.73
5.6.60.0000.00913.89
5.6.50.0130.00314.04
5.6.40.0030.01314.04
5.6.30.0040.01113.91
5.6.20.0040.00714.10
5.6.10.0000.01113.92
5.6.00.0130.00013.97

preferences:
44.45 ms | 401 KiB | 5 Q