3v4l.org

run code in 300+ PHP versions simultaneously
<?php $mapping = [ "AccountId" => "id", "Street" => "street_name", "Country" => "country", "Contacts" => "contacts", "Id" => "contact_id", "Name" => "name" ]; $input2 = [ "AccountId" => "18", "Street" => "Some Street 123", "Country" => "England", "Contacts" => [ [ "Id" => "1234", "Name" => "John Doe" ] ] ]; function mapArray($mapping, $input) { $output = []; foreach ($mapping as $from => $to) { if (array_key_exists($from, $input)) { if (is_array($input[$from])) { $output[$to] = mapArray($mapping, $input[$from]); } else { $output[$to] = $input[$from]; } } } return $output; } $output2 = mapArray($mapping, $input2); var_dump($output2);

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.0090.00616.50
8.3.60.0110.00716.50
8.3.50.0210.00716.53
8.3.40.0110.00418.97
8.3.30.0130.00318.84
8.3.20.0080.00020.33
8.3.10.0080.00021.73
8.3.00.0040.00420.91
8.2.180.0060.01218.39
8.2.170.0110.01122.96
8.2.160.0100.00322.30
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00422.08
8.2.120.0000.00726.35
8.2.110.0070.01120.47
8.2.100.0050.00517.91
8.2.90.0000.00819.30
8.2.80.0050.00318.05
8.2.70.0000.00817.63
8.2.60.0090.00018.05
8.2.50.0040.00418.16
8.2.40.0040.00422.21
8.2.30.0030.00621.14
8.2.20.0000.00718.14
8.2.10.0040.00418.07
8.2.00.0050.00318.04
8.1.280.0120.00325.92
8.1.270.0080.00023.99
8.1.260.0000.00826.35
8.1.250.0000.00728.09
8.1.240.0090.00022.13
8.1.230.0000.01021.03
8.1.220.0040.00417.74
8.1.210.0060.00318.77
8.1.200.0060.00317.48
8.1.190.0030.00617.35
8.1.180.0080.00018.10
8.1.170.0000.00818.47
8.1.160.0000.00719.02
8.1.150.0030.00618.96
8.1.140.0040.00419.62
8.1.130.0000.00718.81
8.1.120.0030.00717.44
8.1.110.0040.00417.49
8.1.100.0050.00317.45
8.1.90.0040.00417.47
8.1.80.0000.00817.35
8.1.70.0000.00717.54
8.1.60.0040.00417.63
8.1.50.0000.00717.50
8.1.40.0040.00417.58
8.1.30.0040.00417.57
8.1.20.0060.00317.50
8.1.10.0000.00717.49
8.1.00.0000.00817.31
8.0.300.0070.00018.77
8.0.290.0040.00416.58
8.0.280.0070.00018.37
8.0.270.0030.00317.25
8.0.260.0030.00316.71
8.0.250.0000.00716.94
8.0.240.0030.00316.87
8.0.230.0000.00717.00
8.0.220.0030.00316.90
8.0.210.0040.00416.79
8.0.200.0030.00316.96
8.0.190.0030.00716.86
8.0.180.0040.00416.75
8.0.170.0080.00016.83
8.0.160.0040.00416.98
8.0.150.0040.00416.84
8.0.140.0030.00716.94
8.0.130.0000.00713.30
8.0.120.0030.00516.86
8.0.110.0040.00416.81
8.0.100.0040.00416.76
8.0.90.0040.00416.77
8.0.80.0030.01216.86
8.0.70.0000.00716.86
8.0.60.0000.00716.81
8.0.50.0000.00716.88
8.0.30.0080.01217.01
8.0.20.0160.01617.40
8.0.10.0030.00317.03
8.0.00.0000.01816.89
7.4.330.0000.00515.55
7.4.320.0000.00616.52
7.4.300.0030.00316.46
7.4.290.0050.00516.58
7.4.280.0100.00016.63
7.4.270.0050.00216.53
7.4.260.0030.00316.42
7.4.250.0000.00716.50
7.4.240.0000.00716.54
7.4.230.0070.00016.68
7.4.220.0120.01216.64
7.4.210.0060.01016.63
7.4.200.0000.00716.68
7.4.160.0100.00616.50
7.4.150.0030.02117.40
7.4.140.0070.01217.86
7.4.130.0060.02016.56
7.4.120.0120.01216.64
7.4.110.0030.01316.60
7.4.100.0070.01016.44
7.4.90.0090.01416.49
7.4.80.0150.00719.39
7.4.70.0060.01016.39
7.4.60.0030.01316.58
7.4.50.0040.00716.42
7.4.40.0160.00716.29
7.4.30.0100.00716.48
7.4.00.0060.01214.84
7.3.330.0000.00713.31
7.3.320.0030.00313.29
7.3.310.0000.00716.38
7.3.300.0040.00416.23
7.3.290.0080.00716.35
7.3.280.0090.00916.34
7.3.270.0090.00917.40
7.3.260.0100.00816.36
7.3.250.0100.00716.32
7.3.240.0050.01316.46
7.3.230.0060.01216.44
7.3.210.0100.00716.41
7.3.200.0030.01316.67
7.3.190.0070.01016.31
7.3.180.0070.01316.31
7.3.170.0030.01216.43
7.3.160.0120.00416.29
7.3.120.0050.01114.85
7.3.110.0080.00714.89
7.3.100.0080.00714.89
7.3.90.0110.00414.91
7.3.80.0100.00514.70
7.3.70.0060.00814.86
7.3.60.0060.00614.87
7.3.50.0060.00514.75
7.3.40.0060.00714.84
7.3.30.0060.00814.84
7.3.20.0080.00816.77
7.3.10.0070.00816.79
7.3.00.0050.00716.60
7.2.330.0120.00616.53
7.2.320.0190.00316.76
7.2.310.0100.00716.86
7.2.300.0110.00616.72
7.2.290.0110.00716.71
7.2.250.0070.01215.23
7.2.240.0040.01415.11
7.2.230.0080.00615.06
7.2.220.0060.00915.00
7.2.210.0120.00415.10
7.2.200.0060.00815.01
7.2.190.0070.00715.12
7.2.180.0080.00715.13
7.2.170.0060.00715.01
7.2.160.0030.00915.13
7.2.150.0110.00716.57
7.2.140.0070.00716.75
7.2.130.0070.00716.85
7.2.120.0060.00816.95
7.2.110.0050.00716.99
7.2.100.0060.00816.88
7.2.90.0070.00716.94
7.2.80.0060.00616.69
7.2.70.0050.01217.02
7.2.60.0060.00716.97
7.2.50.0070.00916.87
7.2.40.0070.00917.01
7.2.30.0090.00616.95
7.2.20.0080.01016.94
7.2.10.0050.01116.99
7.2.00.0100.00617.17
7.1.330.0090.00615.86
7.1.320.0060.01015.79
7.1.310.0100.00615.73
7.1.300.0030.00815.79
7.1.290.0040.00915.65
7.1.280.0070.00815.81
7.1.270.0090.00615.82
7.1.260.0060.00715.85
7.1.250.0060.00715.74
7.1.240.0030.00915.88
7.1.230.0080.00315.79
7.1.220.0080.00615.86
7.1.210.0080.00315.71
7.1.200.0070.00515.81
7.1.190.0070.00715.77
7.1.180.0030.00615.81
7.1.170.0070.00315.87
7.1.160.0040.00415.93
7.1.150.0000.01215.98
7.1.140.0040.00415.53
7.1.130.0070.00715.68
7.1.120.0030.01015.90
7.1.110.0040.00415.67
7.1.100.0070.00417.12
7.1.90.0030.00615.76
7.1.80.0000.01115.69
7.1.70.0030.00716.46
7.1.60.0280.01424.63
7.1.50.0340.00624.37
7.1.40.0320.00524.19
7.1.30.0350.00524.13
7.1.20.0300.01024.19
7.1.10.0180.01115.24
7.1.00.0210.00615.30
7.0.330.0000.01115.41
7.0.320.0000.00915.57
7.0.310.0050.00515.48
7.0.300.0050.00515.36
7.0.290.0030.00715.51
7.0.280.0030.00915.47
7.0.270.0000.01215.38
7.0.260.0040.00815.45
7.0.250.0040.00815.55
7.0.240.0030.00615.59
7.0.230.0030.00615.63
7.0.220.0030.00715.41
7.0.210.0040.00815.39
7.0.200.0300.00515.22
7.0.190.0250.00815.21
7.0.180.0300.01015.06
7.0.170.0230.01214.95
7.0.160.0290.00514.96
7.0.150.0240.00515.17
7.0.140.0200.01015.02
7.0.130.0220.00615.07
7.0.120.0300.00815.18
7.0.110.0260.00914.88
7.0.100.0380.00514.93
7.0.90.0330.00214.90
7.0.80.0500.00914.86
7.0.70.0210.00815.09
7.0.60.0220.00914.88
7.0.50.0220.01114.99
7.0.40.0200.00813.98
7.0.30.0250.00714.05
7.0.20.0230.00614.14
7.0.10.0340.00914.14
7.0.00.0290.00814.03
5.6.380.0080.00413.86

preferences:
46.08 ms | 401 KiB | 5 Q