3v4l.org

run code in 300+ PHP versions simultaneously
<?php class DataHolder { private $rawData; private $parsedData; private $mapping = [ 'dbField1' => 'outputField1', 'dbField2' => ['outputField2' => ['parseFn1', 'parseFn2']] ]; private function parserFn1($value) { return $value * 2; } private function parserFn2($value) { return $value . "$"; } public function __construct(array $data) { $this->rawData = $data; $this->mapData(); } // Yes, I know the methods shouldn't be here but it rather be decoupled in another class and // injected with a DI it but I wrote it like this with example purposes only private function mapData() { foreach($this->mapping as $dbFieldName => $content) { if(isset($this->rawData[$dbFieldName])) { if(is_string($content)) { $parsedData[$content] = $this->rawData[$dbFieldName]; } else if (is_array($content)) { $frontFieldName = key($content); $functionsArray = reset($content); $value = $this->rawData[$dbFieldName]; foreach($functionsArray as $functionName) { if(function_exists(DataHolder::class, $functionName)) { var_dump($functionName); } } } } } } } $data = ['dbField1' => 5, 'dbField2' => 13]; $dh = new DataHolder($data);

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.00718.43
8.3.50.0140.00522.04
8.3.40.0150.00018.94
8.3.30.0110.00418.99
8.3.20.0040.00420.33
8.3.10.0080.00020.70
8.3.00.0030.00519.38
8.2.180.0140.00718.29
8.2.170.0090.00622.96
8.2.160.0120.00620.35
8.2.150.0150.00324.18
8.2.140.0060.00324.66
8.2.130.0040.00426.16
8.2.120.0040.00422.18
8.2.110.0060.00319.37
8.2.100.0130.00018.16
8.2.90.0080.00019.27
8.2.80.0000.00817.97
8.2.70.0090.00017.38
8.2.60.0030.00518.05
8.2.50.0080.00018.10
8.2.40.0040.00418.34
8.2.30.0070.00018.04
8.2.20.0030.00617.70
8.2.10.0000.00718.01
8.2.00.0050.00317.86
8.1.280.0070.01025.92
8.1.270.0090.00923.79
8.1.260.0050.00326.35
8.1.250.0000.00828.09
8.1.240.0030.00619.20
8.1.230.0090.00317.77
8.1.220.0000.00817.78
8.1.210.0060.00318.77
8.1.200.0030.00617.47
8.1.190.0050.00317.36
8.1.180.0020.00518.10
8.1.170.0050.00318.50
8.1.160.0070.00021.91
8.1.150.0040.00418.88
8.1.140.0040.00417.34
8.1.130.0030.00517.88
8.1.120.0030.00317.39
8.1.110.0030.00517.42
8.1.100.0080.00017.44
8.1.90.0000.00717.45
8.1.80.0040.00417.50
8.1.70.0000.00717.49
8.1.60.0040.00817.50
8.1.50.0030.00617.58
8.1.40.0000.00817.48
8.1.30.0000.00817.58
8.1.20.0060.00317.62
8.1.10.0040.00417.59
8.1.00.0060.00317.57
8.0.300.0040.00418.77
8.0.290.0000.00816.75
8.0.280.0000.00718.43
8.0.270.0070.00017.21
8.0.260.0000.00817.22
8.0.250.0070.00016.93
8.0.240.0070.00017.03
8.0.230.0070.00017.00
8.0.220.0000.00716.88
8.0.210.0000.00716.94
8.0.200.0030.00317.00
8.0.190.0050.00317.04
8.0.180.0040.00417.03
8.0.170.0050.00317.03
8.0.160.0040.00416.99
8.0.150.0040.00416.84
8.0.140.0080.00316.82
8.0.130.0070.00213.36
8.0.120.0040.00416.89
8.0.110.0000.00716.91
8.0.100.0040.00416.92
8.0.90.0000.00816.84
8.0.80.0090.01217.02
8.0.70.0000.00916.92
8.0.60.0040.00417.01
8.0.50.0040.00416.86
8.0.30.0050.01517.26
8.0.20.0140.00517.40
8.0.10.0000.00816.99
8.0.00.0090.00916.79
7.4.330.0000.00615.00
7.4.320.0000.00616.57
7.4.300.0000.00716.61
7.4.290.0060.00316.49
7.4.280.0040.00416.63
7.4.270.0030.00316.55
7.4.260.0020.00516.64
7.4.250.0040.00416.48
7.4.240.0030.00516.58
7.4.230.0000.00716.50
7.4.220.0090.01516.63
7.4.210.0100.00616.61
7.4.200.0000.00716.69
7.4.160.0060.01216.46
7.4.150.0130.00617.40
7.4.140.0080.01017.86
7.4.130.0110.00916.47
7.4.120.0110.00616.55
7.4.110.0070.01416.63
7.4.100.0090.01216.66
7.4.90.0170.00316.40
7.4.80.0120.01219.39
7.4.70.0140.00716.69
7.4.60.0100.00716.67
7.4.50.0040.00016.57
7.4.40.0040.01216.44
7.4.30.0120.00616.38
7.4.00.0070.00814.89
7.3.330.0060.00013.46
7.3.320.0000.00613.23
7.3.310.0070.00016.39
7.3.300.0000.00716.43
7.3.290.0130.00316.45
7.3.280.0090.01016.43
7.3.270.0090.00917.40
7.3.260.0160.00316.52
7.3.250.0120.00816.51
7.3.240.0090.01316.55
7.3.230.0080.00816.61
7.3.210.0030.01516.50
7.3.200.0030.01319.39
7.3.190.0160.00016.52
7.3.180.0090.00616.61
7.3.170.0120.00316.66
7.3.160.0090.01216.44
7.3.120.0030.01315.05
7.3.110.0080.00814.95
7.3.100.0120.00315.00
7.3.90.0040.00715.15
7.3.80.0000.01214.58
7.3.70.0000.01414.85
7.3.60.0030.01314.60
7.3.50.0050.00514.77
7.3.40.0130.00314.68
7.3.30.0040.00814.71
7.3.20.0000.01416.50
7.3.10.0000.01316.66
7.3.00.0070.00716.41
7.2.330.0070.01016.69
7.2.320.0000.01716.86
7.2.310.0040.01916.84
7.2.300.0090.01516.78
7.2.290.0090.00916.72
7.2.250.0030.01715.07
7.2.240.0070.01015.04
7.2.230.0090.00614.99
7.2.220.0070.00715.35
7.2.210.0100.00614.68
7.2.200.0100.00315.12
7.2.190.0030.01315.11
7.2.180.0030.00914.98
7.2.170.0000.01015.16
7.2.60.0040.01116.89
7.2.00.0030.01019.47
7.1.330.0040.01115.51
7.1.320.0000.01015.82
7.1.310.0000.01916.00
7.1.300.0060.00915.89
7.1.290.0000.01615.82
7.1.280.0040.01115.92
7.1.270.0060.00315.83
7.1.260.0110.00315.85
7.1.200.0040.00415.89
7.1.100.0070.01117.96
7.1.70.0000.00817.07
7.1.60.0130.01019.32
7.1.50.0100.01017.05
7.1.00.0070.07322.31
7.0.200.0090.00016.52
7.0.140.0070.06321.92
7.0.110.0200.08019.89
7.0.100.0030.05720.00
7.0.90.0200.06019.88
7.0.80.0100.07319.87
7.0.70.0130.07319.80
7.0.60.0030.08319.93
7.0.50.0130.08020.41
7.0.40.0070.08320.13
7.0.30.0200.07020.08
7.0.20.0130.07720.05
7.0.10.0170.07020.25
7.0.00.0030.05320.11
5.6.280.0000.07721.08
5.6.260.0100.08320.66
5.6.250.0000.05320.61
5.6.240.0030.07320.60
5.6.230.0070.08020.43
5.6.220.0130.07020.65
5.6.210.0130.07320.58
5.6.200.0130.07021.23
5.6.190.0100.05021.03
5.6.180.0130.05721.28
5.6.170.0070.08721.10
5.6.160.0070.06721.10
5.6.150.0070.03721.09
5.6.140.0170.05021.03
5.6.130.0130.03721.08
5.6.120.0070.08021.16
5.6.110.0030.09021.03
5.6.100.0070.04021.19
5.6.90.0030.05320.95
5.6.80.0130.07020.41
5.6.70.0100.07720.54
5.6.60.0130.07720.34
5.6.50.0100.07720.54
5.6.40.0070.07320.44
5.6.30.0100.08020.39
5.6.20.0170.07020.35
5.6.10.0100.07020.35
5.6.00.0030.07320.30
5.5.380.0070.07720.28
5.5.370.0070.08020.50
5.5.360.0170.08020.36
5.5.350.0100.08020.36
5.5.340.0070.08320.80
5.5.330.0070.04020.82
5.5.320.0070.05320.88
5.5.310.0070.07020.85
5.5.300.0000.09020.75
5.5.290.0170.07720.91
5.5.280.0030.08020.82
5.5.270.0070.06720.88
5.5.260.0100.07720.89
5.5.250.0000.07720.64
5.5.240.0070.06020.30
5.5.230.0130.07720.19
5.5.220.0100.07720.34
5.5.210.0000.06320.29
5.5.200.0270.06020.32
5.5.190.0130.06720.20
5.5.180.0100.06320.20
5.5.160.0030.08020.30
5.5.150.0100.07020.30
5.5.140.0200.06020.26
5.5.130.0170.07720.33
5.5.120.0100.06720.26
5.5.110.0030.06320.16
5.5.100.0100.07320.20
5.5.90.0100.07720.15
5.5.80.0100.06720.17
5.5.70.0100.05020.15
5.5.60.0030.07320.11
5.5.50.0070.07720.14
5.5.40.0100.05720.25
5.5.30.0130.07020.17
5.5.20.0130.07320.24
5.5.10.0070.08020.17
5.5.00.0100.07020.24
5.4.450.0130.05319.67
5.4.440.0130.06719.34
5.4.430.0130.04019.57
5.4.420.0100.07319.63
5.4.410.0130.07019.18
5.4.400.0030.08018.99
5.4.390.0100.07019.27
5.4.380.0130.06319.02
5.4.370.0170.06319.38
5.4.360.0070.07319.16
5.4.350.0100.07019.23
5.4.340.0100.07718.99
5.4.320.0070.07319.32
5.4.310.0130.06719.16
5.4.300.0030.04719.19
5.4.290.0100.04019.22
5.4.280.0100.07719.00
5.4.270.0100.07018.98
5.4.260.0070.07719.00
5.4.250.0100.07019.00
5.4.240.0170.05718.99
5.4.230.0070.07719.33
5.4.220.0030.08018.95
5.4.210.0070.05719.20
5.4.200.0030.08319.33
5.4.190.0070.07019.23
5.4.180.0070.05018.94
5.4.170.0070.04319.00
5.4.160.0070.07718.97
5.4.150.0200.03319.08
5.4.140.0100.04016.64
5.4.130.0000.06016.30
5.4.120.0100.05716.36
5.4.110.0100.06716.60
5.4.100.0100.07016.47
5.4.90.0030.06716.52
5.4.80.0100.06716.59
5.4.70.0070.06016.69
5.4.60.0030.06716.40
5.4.50.0030.03716.52
5.4.40.0030.07316.28
5.4.30.0000.08016.39
5.4.20.0170.06316.56
5.4.10.0070.07716.56
5.4.00.0100.06715.99
5.3.290.0000.09014.67
5.3.280.0030.08014.61
5.3.270.0100.06714.75
5.3.260.0000.08014.56
5.3.250.0100.06014.68
5.3.240.0170.05714.45
5.3.230.0030.05014.55
5.3.220.0000.04714.41
5.3.210.0030.07714.52
5.3.200.0070.04314.69
5.3.190.0070.07014.70
5.3.180.0100.06314.68
5.3.170.0130.06314.58
5.3.160.0170.06014.57
5.3.150.0070.06014.51
5.3.140.0030.05014.69
5.3.130.0130.05314.68
5.3.120.0100.06714.67
5.3.110.0030.04714.77
5.3.100.0100.06314.13
5.3.90.0100.05313.98
5.3.80.0100.06314.09
5.3.70.0130.06713.87
5.3.60.0030.07313.95
5.3.50.0030.07314.09
5.3.40.0100.07313.80
5.3.30.0030.07013.90
5.3.20.0070.07013.81
5.3.10.0070.06313.66
5.3.00.0070.07013.67
5.2.170.0070.05311.70
5.2.160.0030.05711.70
5.2.150.0070.04011.70
5.2.140.0100.05711.70
5.2.130.0070.06311.70
5.2.120.0100.03311.70
5.2.110.0100.05311.70
5.2.100.0030.05711.70
5.2.90.0100.05011.70
5.2.80.0100.06311.70
5.2.70.0100.05711.70
5.2.60.0000.05311.70
5.2.50.0070.05711.70
5.2.40.0070.06311.70
5.2.30.0100.05711.70
5.2.20.0100.05311.70
5.2.10.0030.03711.70
5.2.00.0100.05011.70
5.1.60.0070.02711.70
5.1.50.0030.05311.70
5.1.40.0070.04011.70
5.1.30.0100.05311.70
5.1.20.0070.05311.70
5.1.10.0070.04711.70
5.1.00.0030.05011.70
5.0.50.0030.02311.70
5.0.40.0000.04311.70
5.0.30.0030.06311.70
5.0.20.0030.05311.70
5.0.10.0100.02011.70
5.0.00.0000.06711.70
4.4.90.0070.03011.70
4.4.80.0030.03311.70
4.4.70.0030.03311.70
4.4.60.0030.03711.70
4.4.50.0030.03311.70
4.4.40.0000.05711.70
4.4.30.0070.03311.70
4.4.20.0000.04311.70
4.4.10.0000.02011.70
4.4.00.0030.05311.70
4.3.110.0070.03011.70
4.3.100.0000.02711.70
4.3.90.0100.02711.70
4.3.80.0030.05011.70
4.3.70.0000.03311.70
4.3.60.0030.02711.70
4.3.50.0030.03711.70
4.3.40.0000.05011.70
4.3.30.0030.03311.70
4.3.20.0000.03311.70
4.3.10.0000.03711.70
4.3.00.0000.03011.70

preferences:
54.88 ms | 401 KiB | 5 Q