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]); } $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.63
8.3.60.0100.00716.50
8.3.50.0080.00816.49
8.3.40.0040.01118.71
8.3.30.0070.00718.89
8.3.20.0040.00420.34
8.3.10.0040.00421.73
8.3.00.0040.00420.90
8.2.180.0090.00518.24
8.2.170.0070.00722.96
8.2.160.0080.00522.28
8.2.150.0030.00524.18
8.2.140.0050.00324.66
8.2.130.0040.00422.25
8.2.120.0040.00426.35
8.2.110.0090.00020.52
8.2.100.0130.00017.84
8.2.90.0030.00619.34
8.2.80.0090.00018.05
8.2.70.0030.00517.50
8.2.60.0040.00417.92
8.2.50.0040.00418.10
8.2.40.0000.00822.13
8.2.30.0000.00720.98
8.2.20.0080.00018.18
8.2.10.0040.00418.11
8.2.00.0040.00418.18
8.1.280.0040.01125.92
8.1.270.0040.00423.96
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0050.00520.71
8.1.230.0120.00019.16
8.1.220.0060.00317.74
8.1.210.0000.00918.77
8.1.200.0040.00417.35
8.1.190.0080.00017.35
8.1.180.0040.00418.10
8.1.170.0080.00018.71
8.1.160.0040.00419.07
8.1.150.0030.00618.89
8.1.140.0040.00419.49
8.1.130.0070.00018.87
8.1.120.0100.00017.50
8.1.110.0040.00417.50
8.1.100.0040.00417.46
8.1.90.0000.00717.44
8.1.80.0040.00417.36
8.1.70.0080.00317.34
8.1.60.0040.00417.58
8.1.50.0000.00817.38
8.1.40.0080.00017.50
8.1.30.0000.00717.64
8.1.20.0040.00417.63
8.1.10.0000.00717.48
8.1.00.0000.00717.46
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0030.00318.46
8.0.270.0040.00417.30
8.0.260.0000.00616.87
8.0.250.0040.00416.96
8.0.240.0000.00816.79
8.0.230.0000.00716.98
8.0.220.0070.00016.89
8.0.210.0050.00216.80
8.0.200.0050.00316.97
8.0.190.0070.00416.92
8.0.180.0070.00016.93
8.0.170.0070.00016.95
8.0.160.0000.00716.74
8.0.150.0040.00416.77
8.0.140.0050.00316.86
8.0.130.0000.00713.23
8.0.120.0040.00416.83
8.0.110.0060.00316.72
8.0.100.0040.00416.76
8.0.90.0040.00416.84
8.0.80.0080.00816.95
8.0.70.0020.00516.74
8.0.60.0070.00016.90
8.0.50.0000.00816.85
8.0.30.0070.00917.02
8.0.20.0090.01017.40
8.0.10.0040.00417.05
8.0.00.0150.00316.89
7.4.330.0000.00515.55
7.4.320.0070.00016.52
7.4.300.0050.00216.57
7.4.290.0000.01016.46
7.4.280.0030.00616.52
7.4.270.0070.00016.52
7.4.260.0050.00316.50
7.4.250.0070.00016.54
7.4.240.0030.00316.61
7.4.230.0030.00616.59
7.4.220.0140.01416.40
7.4.210.0000.01416.57
7.4.200.0040.00416.63
7.4.160.0120.01216.66
7.4.150.0140.00317.40
7.4.140.0160.00517.86
7.4.130.0170.00616.70
7.4.120.0120.01116.55
7.4.110.0150.00316.43
7.4.100.0060.01316.44
7.4.90.0080.00816.47
7.4.80.0140.00419.39
7.4.70.0070.01416.60
7.4.60.0100.00616.68
7.4.50.0090.00616.47
7.4.40.0130.00316.46
7.4.30.0040.01216.38
7.4.00.0090.00714.92
7.3.330.0030.00313.39
7.3.320.0030.00313.34
7.3.310.0000.00716.22
7.3.300.0000.00716.37
7.3.290.0070.00916.34
7.3.280.0070.00916.37
7.3.270.0120.00617.40
7.3.260.0070.01016.47
7.3.250.0080.01316.52
7.3.240.0080.01016.36
7.3.230.0110.00716.36
7.3.210.0140.00316.48
7.3.200.0110.00516.68
7.3.190.0130.00316.28
7.3.180.0100.01016.46
7.3.170.0040.01216.52
7.3.160.0060.00916.46
7.3.120.0070.01214.85
7.3.110.0080.00915.00
7.3.100.0050.01014.77
7.3.90.0070.00714.83
7.3.80.0050.00814.81
7.3.70.0030.00614.84
7.3.60.0050.00814.98
7.3.50.0050.00514.88
7.3.40.0060.00814.77
7.3.30.0070.00714.63
7.3.20.0050.01016.66
7.3.10.0020.00816.52
7.3.00.0070.00816.57
7.2.330.0130.00616.50
7.2.320.0090.00816.47
7.2.310.0110.00616.79
7.2.300.0130.00316.52
7.2.290.0040.01316.87
7.2.250.0050.01515.06
7.2.240.0080.01115.09
7.2.230.0090.00915.19
7.2.220.0020.00914.92
7.2.210.0020.01515.06
7.2.200.0110.00415.21
7.2.190.0020.01315.22
7.2.180.0020.01115.04
7.2.170.0070.00915.06
7.2.130.0110.00416.84
7.2.120.0080.00816.81
7.2.110.0120.00017.03
7.2.100.0040.00816.92
7.2.90.0030.00916.76
7.2.80.0110.00316.80
7.2.70.0000.01416.71
7.2.60.0040.00916.96
7.2.50.0070.00716.74
7.2.40.0070.00716.73
7.2.30.0070.01116.88
7.2.20.0060.00916.64
7.2.10.0060.00617.06
7.2.00.0030.00917.09
7.1.330.0000.01515.73
7.1.320.0080.00515.58
7.1.310.0030.01015.60
7.1.300.0000.01215.75
7.1.290.0100.00215.88
7.1.280.0030.00915.81
7.1.270.0060.00815.79
7.1.260.0080.00615.79
7.1.250.0100.00315.63
7.1.240.0030.00815.64
7.1.230.0110.00415.53
7.1.220.0000.00915.67
7.1.210.0090.00615.51
7.1.200.0060.00615.67
7.1.190.0040.00415.95
7.1.180.0030.00915.59
7.1.170.0040.01115.89
7.1.160.0070.00315.66
7.1.150.0120.00315.61
7.1.140.0040.00715.69
7.1.130.0070.00715.89
7.1.120.0040.00815.80
7.1.110.0000.01115.90
7.1.100.0000.01215.71
7.1.90.0100.00315.84
7.1.80.0030.00615.69
7.1.70.0030.00516.49
7.1.60.0320.01224.54
7.1.50.0230.01324.33
7.1.40.0250.01224.16
7.1.30.0350.00824.31
7.1.20.0320.00724.36
7.1.10.0220.00615.25
7.1.00.0290.00515.27
7.0.330.0000.01015.18
7.0.320.0030.01315.50
7.0.310.0000.01615.04
7.0.300.0000.01015.29
7.0.290.0060.00615.31
7.0.280.0040.00415.16
7.0.270.0100.00315.27
7.0.260.0030.00915.27
7.0.250.0060.00615.04
7.0.240.0050.00515.45
7.0.230.0000.01415.34
7.0.220.0060.00615.24
7.0.210.0030.00815.34
7.0.200.0250.00915.12
7.0.190.0310.00515.28
7.0.180.0250.00714.85
7.0.170.0260.00814.92
7.0.160.0210.01014.61
7.0.150.0210.00714.84
7.0.140.0230.01214.96
7.0.130.0190.01214.95
7.0.120.0210.00614.96
7.0.110.0270.01014.86
7.0.100.0340.00715.03
7.0.90.0250.00614.96
7.0.80.0250.01014.76
7.0.70.0170.01014.95
7.0.60.0340.00814.98
7.0.50.0180.01114.88
7.0.40.0170.01113.96
7.0.30.0210.00614.03
7.0.20.0350.00813.94
7.0.10.0200.00814.06
7.0.00.0600.00314.06
5.6.380.0100.00314.30

preferences:
39.3 ms | 400 KiB | 5 Q