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) { foreach ($mapping as $from => $to) { if (array_key_exists($from, $input)) { if (is_array($input[$from])) { $output[$to] = mapArray($mapping, $input[$from]); } $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.0170.00316.75
8.3.60.0130.00316.88
8.3.50.0090.01117.48
8.3.40.0150.00018.97
8.3.30.0000.01418.56
8.3.20.0030.00520.16
8.3.10.0040.00421.73
8.3.00.0040.00420.87
8.2.180.0100.00518.30
8.2.170.0040.01122.96
8.2.160.0130.00022.21
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0050.00322.25
8.2.120.0000.00826.35
8.2.110.0060.00320.47
8.2.100.0040.00717.91
8.2.90.0080.00019.11
8.2.80.0050.00317.97
8.2.70.0040.00417.38
8.2.60.0000.00818.05
8.2.50.0040.00418.10
8.2.40.0080.00022.27
8.2.30.0040.00421.05
8.2.20.0000.00718.06
8.2.10.0040.00418.14
8.2.00.0040.00418.13
8.1.280.0060.00925.92
8.1.270.0000.00723.79
8.1.260.0000.00726.35
8.1.250.0040.00428.09
8.1.240.0030.00620.97
8.1.230.0090.00319.10
8.1.220.0000.00917.74
8.1.210.0040.00418.77
8.1.200.0030.00617.47
8.1.190.0060.00317.35
8.1.180.0030.00618.10
8.1.170.0080.00018.49
8.1.160.0070.00019.06
8.1.150.0030.00518.80
8.1.140.0000.00719.52
8.1.130.0040.00218.89
8.1.120.0050.00317.46
8.1.110.0050.00217.50
8.1.100.0080.00017.39
8.1.90.0000.00817.39
8.1.80.0040.00417.37
8.1.70.0000.00917.44
8.1.60.0030.00517.57
8.1.50.0080.00017.43
8.1.40.0000.00717.51
8.1.30.0070.00017.61
8.1.20.0000.00717.66
8.1.10.0040.00417.45
8.1.00.0000.00717.48
8.0.300.0060.00318.77
8.0.290.0000.00816.63
8.0.280.0030.00318.36
8.0.270.0030.00517.22
8.0.260.0030.00316.88
8.0.250.0000.00716.98
8.0.240.0070.00016.91
8.0.230.0050.00317.00
8.0.220.0030.00316.96
8.0.210.0000.00717.00
8.0.200.0030.00316.90
8.0.190.0150.00016.92
8.0.180.0070.00016.91
8.0.170.0000.00716.90
8.0.160.0020.00516.97
8.0.150.0040.00416.80
8.0.140.0000.00716.88
8.0.130.0000.00713.30
8.0.120.0000.00716.90
8.0.110.0000.00716.79
8.0.100.0000.00716.77
8.0.90.0040.00416.92
8.0.80.0040.01116.91
8.0.70.0000.00716.80
8.0.60.0040.00417.02
8.0.50.0000.00816.93
8.0.30.0110.00817.21
8.0.20.0120.00917.40
8.0.10.0050.00317.10
8.0.00.0160.00716.77
7.4.330.0050.00015.55
7.4.320.0030.00316.66
7.4.300.0000.00616.52
7.4.290.0060.00316.47
7.4.280.0060.00316.59
7.4.270.0050.00316.64
7.4.260.0040.00416.56
7.4.250.0040.00416.42
7.4.240.0030.00316.61
7.4.230.0040.00416.41
7.4.220.0170.01016.61
7.4.210.0070.01016.55
7.4.200.0030.00316.71
7.4.160.0130.00316.63
7.4.150.0150.00417.40
7.4.140.0110.00817.86
7.4.130.0200.00716.55
7.4.120.0140.00416.53
7.4.110.0130.01016.64
7.4.100.0140.00716.62
7.4.90.0100.01316.43
7.4.80.0100.00719.39
7.4.70.0090.00916.51
7.4.60.0130.00716.38
7.4.50.0040.01116.60
7.4.40.0080.00816.52
7.4.30.0090.00616.52
7.4.10.0040.01414.93
7.4.00.0060.00914.99
7.3.330.0020.00213.36
7.3.320.0050.00013.38
7.3.310.0030.00416.27
7.3.300.0060.00016.43
7.3.290.0070.00816.38
7.3.280.0080.00916.41
7.3.270.0080.00917.40
7.3.260.0060.01116.32
7.3.250.0140.00916.38
7.3.240.0080.01216.41
7.3.230.0110.00716.64
7.3.210.0070.01016.38
7.3.200.0050.01116.39
7.3.190.0150.00616.38
7.3.180.0040.01216.59
7.3.170.0100.00716.48
7.3.160.0060.01016.45
7.3.130.0110.00714.84
7.3.120.0100.00714.91
7.3.110.0120.00914.98
7.3.100.0070.00714.52
7.3.90.0060.01314.84
7.3.80.0120.00615.04
7.3.70.0030.01015.02
7.3.60.0110.00414.98
7.3.50.0060.00614.98
7.3.40.0000.01114.73
7.3.30.0040.00814.81
7.3.20.0030.00716.69
7.3.10.0000.01416.49
7.3.00.0100.00316.49
7.2.330.0090.00916.58
7.2.320.0150.00716.71
7.2.310.0080.00816.73
7.2.300.0060.01116.77
7.2.290.0130.00416.58
7.2.260.0060.01315.16
7.2.250.0060.01215.37
7.2.240.0100.00315.16
7.2.230.0000.01414.86
7.2.220.0060.00615.30
7.2.210.0070.01115.32
7.2.200.0060.00915.13
7.2.190.0100.00315.20
7.2.180.0090.00314.96
7.2.170.0060.00315.16
7.2.160.0040.01115.11
7.2.150.0090.00017.00
7.2.140.0070.00716.98
7.2.130.0040.01216.84
7.2.120.0030.00917.04
7.2.110.0000.01016.98
7.2.100.0070.00716.79
7.2.90.0000.01016.97
7.2.80.0060.00316.98
7.2.70.0040.01116.88
7.2.60.0060.00816.90
7.2.50.0060.00617.03
7.2.40.0100.00617.01
7.2.30.0030.01017.06
7.2.20.0100.00016.66
7.2.10.0040.00817.05
7.2.00.0080.00718.24
7.1.330.0040.00815.71
7.1.320.0060.01016.00
7.1.310.0030.00715.53
7.1.300.0060.00815.85
7.1.290.0000.01115.75
7.1.280.0000.01215.73
7.1.270.0040.01115.89
7.1.260.0030.00915.67
7.1.250.0060.00315.97
7.1.240.0030.01215.86
7.1.230.0070.00415.98
7.1.220.0080.00815.74
7.1.210.0000.01015.88
7.1.200.0050.00915.88
7.1.190.0030.01015.46
7.1.180.0030.00915.52
7.1.170.0030.01415.63
7.1.160.0060.00615.93
7.1.150.0120.00415.78
7.1.140.0030.00615.96
7.1.130.0030.00615.50
7.1.120.0120.00315.86
7.1.110.0080.00415.48
7.1.100.0070.00616.97
7.1.90.0000.01316.02
7.1.80.0030.01315.91
7.1.70.0040.00716.24
7.1.60.0220.01124.66
7.1.50.0170.01724.20
7.1.40.0220.00724.31
7.1.30.0220.01224.06
7.1.20.0230.01024.24
7.1.10.0170.00815.40
7.1.00.0250.00715.38
7.0.330.0030.01015.61
7.0.320.0080.00815.39
7.0.310.0030.01015.52
7.0.300.0040.01315.34
7.0.290.0040.00415.47
7.0.280.0060.00815.42
7.0.270.0070.00515.57
7.0.260.0030.00915.67
7.0.250.0030.00815.54
7.0.240.0080.00315.47
7.0.230.0030.01015.24
7.0.220.0090.00315.56
7.0.210.0060.00915.25
7.0.200.0170.01315.26
7.0.190.0450.00815.14
7.0.180.0150.00915.08
7.0.170.0150.00914.96
7.0.160.0170.00914.94
7.0.150.0120.01714.85
7.0.140.0110.00615.12
7.0.130.0180.01315.10
7.0.120.0250.00615.04
7.0.110.0200.01015.05
7.0.100.0040.00714.97
7.0.90.0420.00515.01
7.0.80.0250.00915.09
7.0.70.0250.01114.98
7.0.60.0230.00514.93
7.0.50.0230.01215.16
7.0.40.0080.00514.06
7.0.30.0040.00914.20
7.0.20.0230.01014.00
7.0.10.0260.00813.94
7.0.00.0200.01414.04
5.6.400.0030.00914.23
5.6.390.0040.01114.50
5.6.380.0090.00314.50
5.6.370.0030.00814.13
5.6.360.0040.00414.16
5.6.350.0120.00314.68
5.6.340.0060.00914.52
5.6.330.0100.00714.66
5.6.320.0070.00714.23
5.6.310.0040.01214.54
5.6.300.0000.00914.68
5.6.290.0000.01614.56
5.6.280.0030.01014.44
5.6.270.0090.00314.41
5.6.260.0120.00014.45
5.6.250.0000.00814.32
5.6.240.0030.01014.15
5.6.230.0050.00514.46
5.6.220.0030.00714.35
5.6.210.0060.00314.20
5.6.200.0070.00714.19
5.6.190.0120.00314.27
5.6.180.0060.00614.25
5.6.170.0030.00614.47
5.6.160.0000.01714.28
5.6.150.0060.00314.61
5.6.140.0030.00914.47
5.6.130.0090.00314.45
5.6.120.0030.01014.43
5.6.110.0030.01214.75
5.6.100.0150.00314.17
5.6.90.0060.00614.54
5.6.80.0000.00914.17
5.6.70.0100.00614.04
5.6.60.0110.00414.23
5.6.50.0040.00714.07
5.6.40.0110.00414.30
5.6.30.0030.01314.17
5.6.20.0030.01314.16
5.6.10.0060.00614.16
5.6.00.0030.00914.29

preferences:
56.31 ms | 401 KiB | 5 Q