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); } 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 $command; } } // 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.0070.01116.75
8.3.50.0120.00316.64
8.3.40.0140.00018.94
8.3.30.0090.00618.77
8.3.20.0080.00020.29
8.3.10.0030.00623.52
8.3.00.0050.00322.09
8.2.180.0000.01416.60
8.2.170.0040.01222.96
8.2.160.0090.00619.01
8.2.150.0050.00224.18
8.2.140.0040.00424.66
8.2.130.0080.00021.04
8.2.120.0040.00426.35
8.2.110.0060.00322.29
8.2.100.0040.00817.91
8.2.90.0050.00319.17
8.2.80.0000.00817.97
8.2.70.0080.00017.75
8.2.60.0070.00318.03
8.2.50.0080.00018.10
8.2.40.0040.00420.36
8.2.30.0040.00420.95
8.2.20.0040.00417.96
8.2.10.0060.00318.02
8.2.00.0000.00717.95
8.1.280.0110.00725.92
8.1.270.0000.00722.23
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0030.00620.92
8.1.230.0120.00019.15
8.1.220.0040.00417.74
8.1.210.0050.00318.77
8.1.200.0060.00317.23
8.1.190.0000.00817.13
8.1.180.0000.00818.10
8.1.170.0060.00318.96
8.1.160.0050.00319.10
8.1.150.0040.00420.57
8.1.140.0040.00419.45
8.1.130.0020.00518.80
8.1.120.0080.00017.48
8.1.110.0040.00417.39
8.1.100.0000.00817.46
8.1.90.0060.00317.32
8.1.80.0040.00417.31
8.1.70.0080.00017.42
8.1.60.0050.00317.61
8.1.50.0060.00317.48
8.1.40.0060.00317.54
8.1.30.0000.00817.67
8.1.20.0050.00317.62
8.1.10.0030.00617.64
8.1.00.0000.00717.52
8.0.300.0000.00819.89
8.0.290.0040.00416.75
8.0.280.0070.00018.40
8.0.270.0040.00417.25
8.0.260.0000.00716.83
8.0.250.0000.00717.01
8.0.240.0040.00416.87
8.0.230.0070.00016.98
8.0.220.0050.00216.82
8.0.210.0030.00316.79
8.0.200.0030.00316.87
8.0.190.0050.00316.94
8.0.180.0060.00616.89
8.0.170.0030.00416.85
8.0.160.0000.00716.99
8.0.150.0000.00716.79
8.0.140.0040.00416.92
8.0.130.0000.00713.39
8.0.120.0040.00416.78
8.0.110.0070.00016.93
8.0.100.0040.00416.76
8.0.90.0040.00416.92
8.0.80.0030.01916.97
8.0.70.0000.00717.02
8.0.60.0080.00016.93
8.0.50.0050.00216.89
8.0.30.0080.01117.08
8.0.20.0090.01117.40
8.0.10.0000.00717.04
8.0.00.0120.00616.81
7.4.330.0060.00015.55
7.4.320.0030.00316.39
7.4.300.0030.00316.63
7.4.290.0000.00716.44
7.4.280.0040.00416.44
7.4.270.0070.00016.50
7.4.260.0030.00316.52
7.4.250.0000.00716.49
7.4.240.0000.00716.63
7.4.230.0080.00016.73
7.4.220.0140.01016.54
7.4.210.0080.00816.61
7.4.200.0030.00316.72
7.4.160.0100.00716.54
7.4.150.0130.00617.40
7.4.140.0110.00817.86
7.4.130.0130.01016.52
7.4.120.0080.01116.54
7.4.110.0080.00816.48
7.4.100.0130.00316.55
7.4.90.0090.00916.48
7.4.80.0150.00519.39
7.4.70.0080.00816.57
7.4.60.0080.00816.52
7.4.50.0080.00516.50
7.4.40.0060.01216.49
7.4.30.0030.01316.37
7.4.00.0070.01014.97
7.3.330.0030.00313.35
7.3.320.0030.00313.28
7.3.310.0000.00716.41
7.3.300.0000.00816.45
7.3.290.0070.00016.28
7.3.280.0080.00816.46
7.3.270.0000.01717.40
7.3.260.0080.01616.41
7.3.250.0090.01116.52
7.3.240.0100.01016.54
7.3.230.0320.02316.59
7.3.210.0100.01016.45
7.3.200.0070.01316.42
7.3.190.0030.01216.43
7.3.180.0100.00516.58
7.3.170.0040.01216.55
7.3.160.0100.00616.25
7.2.330.0150.00316.69
7.2.320.0140.00316.53
7.2.310.0070.01416.80
7.2.300.0030.01316.78
7.2.290.0090.00916.57
7.2.90.0270.00814.89
7.2.80.0140.00614.72
7.2.70.0120.01214.70
7.2.60.0710.01314.93
7.2.50.0080.01115.32
7.2.40.1440.00314.80
7.2.30.1190.01214.94
7.2.20.1100.01015.20
7.2.10.1040.00315.20
7.2.00.0040.01215.00
7.1.210.0210.00313.75
7.1.200.0070.01113.99
7.1.190.0380.00413.91
7.1.180.0040.01413.92
7.1.170.0260.00913.88
7.1.160.1500.00313.79
7.1.150.1110.00314.07
7.1.140.1190.01013.82
7.1.130.0880.00613.80
7.1.120.0100.00613.90
7.1.110.0130.00314.04
7.1.100.0490.01014.14
7.1.90.0160.01014.19
7.1.80.0430.00414.05
7.1.70.0350.01214.09
7.1.60.1260.01331.96
7.1.50.0760.01332.01
7.1.40.0340.01031.77
7.1.30.0690.00931.92
7.1.20.0830.00331.89
7.1.10.0140.00613.81
7.1.00.2360.00713.93
7.0.310.0040.01112.94
7.0.300.0100.01313.65
7.0.290.1320.00313.54
7.0.280.1540.01313.46
7.0.270.0830.00313.68
7.0.260.0080.00813.55
7.0.250.0630.00713.70
7.0.240.0070.01413.69
7.0.230.1380.01313.75
7.0.220.0110.01113.50
7.0.210.0380.00713.46
7.0.200.0440.01013.57
7.0.190.0450.01013.77
7.0.180.1430.01113.28
7.0.170.0080.01113.66
7.0.160.0630.00713.71
7.0.150.0590.00313.56
7.0.140.2290.01013.27
7.0.130.0100.01013.62
7.0.120.0090.00913.30
7.0.110.0110.00613.31
7.0.100.0150.00013.44
7.0.90.0150.00613.27
7.0.80.1310.01313.38
7.0.70.0130.00413.05
7.0.60.0090.00313.27
7.0.50.0130.00713.69
7.0.40.0090.00913.39
7.0.30.0140.00913.57
7.0.20.0090.00313.49
7.0.10.0240.00813.43
7.0.00.0120.00413.58

preferences:
50.07 ms | 401 KiB | 5 Q