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])) { echo $input[$from]; $output[$to] = mapArray($mapping, $input[$from]); } else { echo $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.60.0150.00317.00
8.3.50.0070.00716.34
8.3.40.0120.00319.02
8.3.30.0040.01118.98
8.3.20.0000.00820.34
8.3.10.0080.00021.75
8.3.00.0040.00420.96
8.2.180.0100.00718.18
8.2.170.0110.00822.96
8.2.160.0030.01022.26
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0000.00722.16
8.2.120.0050.00326.35
8.2.110.0080.00322.20
8.2.100.0130.00018.03
8.2.90.0040.00419.20
8.2.80.0000.00818.16
8.2.70.0040.00417.75
8.2.60.0030.00617.93
8.2.50.0000.00818.10
8.2.40.0040.00422.14
8.2.30.0000.00821.14
8.2.20.0050.00318.20
8.2.10.0050.00318.23
8.2.00.0000.00718.18
8.1.280.0000.01425.92
8.1.270.0040.00422.06
8.1.260.0030.00526.35
8.1.250.0040.00428.09
8.1.240.0060.00323.83
8.1.230.0070.00322.12
8.1.220.0040.00417.79
8.1.210.0000.01018.77
8.1.200.0000.00917.35
8.1.190.0030.00517.35
8.1.180.0050.00318.10
8.1.170.0060.00318.46
8.1.160.0070.00018.90
8.1.150.0080.00018.89
8.1.140.0040.00419.45
8.1.130.0030.00318.89
8.1.120.0090.00017.53
8.1.110.0060.00317.45
8.1.100.0000.00817.37
8.1.90.0050.00217.45
8.1.80.0000.00717.34
8.1.70.0050.00217.46
8.1.60.0030.00617.55
8.1.50.0000.00817.53
8.1.40.0000.00817.48
8.1.30.0040.00417.61
8.1.20.0000.00717.61
8.1.10.0030.00517.44
8.1.00.0030.00617.52
8.0.300.0000.00718.77
8.0.290.0040.00416.75
8.0.280.0000.00718.51
8.0.270.0070.00017.18
8.0.260.0030.00316.89
8.0.250.0000.00716.94
8.0.240.0050.00216.84
8.0.230.0040.00417.00
8.0.220.0030.00316.88
8.0.210.0000.00716.93
8.0.200.0060.00016.98
8.0.190.0030.00616.99
8.0.180.0030.00916.89
8.0.170.0040.00417.02
8.0.160.0040.00417.02
8.0.150.0030.00716.96
8.0.140.0040.00416.93
8.0.130.0030.00513.31
8.0.120.0040.00416.83
8.0.110.0000.00816.96
8.0.100.0000.00817.07
8.0.90.0030.00516.98
8.0.80.0120.00817.02
8.0.70.0060.00316.86
8.0.60.0030.00516.79
8.0.50.0030.00516.81
8.0.30.0110.01017.11
8.0.20.0120.00717.40
8.0.10.0050.00216.98
8.0.00.0140.00316.88
7.4.330.0020.00215.55
7.4.320.0030.00316.61
7.4.300.0000.00716.64
7.4.290.0040.00416.58
7.4.280.0000.00816.40
7.4.270.0030.00316.58
7.4.260.0030.00316.64
7.4.250.0030.00316.62
7.4.240.0040.00416.66
7.4.230.0070.00016.35
7.4.220.0060.01316.47
7.4.210.0130.00716.64
7.4.200.0070.00016.61
7.4.160.0110.00816.50
7.4.150.0090.00917.40
7.4.140.0120.00817.86
7.4.130.0130.00916.55
7.4.120.0110.01016.54
7.4.110.0070.01016.71
7.4.100.0150.00316.41
7.4.90.0140.00416.52
7.4.80.0090.00919.39
7.4.70.0070.01116.71
7.4.60.0100.00716.67
7.4.50.0070.00716.57
7.4.40.0030.01316.71
7.4.30.0060.00916.82
7.4.00.0100.00715.10
7.3.330.0030.00313.29
7.3.320.0050.00013.23
7.3.310.0070.00016.45
7.3.300.0000.00716.23
7.3.290.0060.00816.44
7.3.280.0090.00816.40
7.3.270.0160.00617.40
7.3.260.0110.00616.49
7.3.250.0100.00716.42
7.3.240.0060.01116.35
7.3.230.0100.00716.44
7.3.210.0140.00416.45
7.3.200.0060.01016.82
7.3.190.0060.00916.43
7.3.180.0130.00316.42
7.3.170.0130.00316.43
7.3.160.0110.00616.45
7.3.120.0040.01614.89
7.3.110.0060.00914.79
7.3.100.0100.01014.93
7.3.90.0040.00814.89
7.3.80.0070.00714.79
7.3.70.0130.00014.87
7.3.60.0110.00714.84
7.3.50.0070.00714.84
7.3.40.0070.00414.92
7.3.30.0060.01014.77
7.3.20.0060.01216.77
7.3.10.0100.00716.89
7.3.00.0090.00316.84
7.2.330.0120.00916.79
7.2.320.0090.00916.51
7.2.310.0070.01116.79
7.2.300.0080.00816.36
7.2.290.0110.00616.65
7.2.250.0070.01015.02
7.2.240.0100.01014.76
7.2.230.0040.01115.23
7.2.220.0100.00315.04
7.2.210.0090.00915.02
7.2.200.0080.00815.23
7.2.190.0000.01815.15
7.2.180.0060.00615.03
7.2.170.0000.01515.19
7.2.160.0070.00714.86
7.2.150.0080.01116.98
7.2.140.0030.00717.09
7.2.130.0080.00316.96
7.2.120.0080.00417.01
7.2.110.0070.01017.14
7.2.100.0100.00317.13
7.2.90.0110.00016.91
7.2.80.0040.01116.82
7.2.70.0040.01217.05
7.2.60.0080.00516.89
7.2.50.0000.01017.00
7.2.40.0080.00816.72
7.2.30.0090.00317.13
7.2.20.0040.01217.14
7.2.10.0090.00916.84
7.2.00.0040.00918.12
7.1.330.0060.01215.81
7.1.320.0040.01215.77
7.1.310.0070.01015.96
7.1.300.0000.01416.04
7.1.290.0030.00615.83
7.1.280.0070.00715.80
7.1.270.0070.01115.71
7.1.260.0030.00615.77
7.1.250.0070.00315.63
7.1.240.0060.00315.99
7.1.230.0000.01015.76
7.1.220.0110.00415.95
7.1.210.0110.00415.79
7.1.200.0070.00715.72
7.1.190.0090.00015.84
7.1.180.0030.00915.93
7.1.170.0000.00815.78
7.1.160.0060.00615.96
7.1.150.0040.00715.89
7.1.140.0070.00715.93
7.1.130.0110.00415.56
7.1.120.0040.00415.91
7.1.110.0030.00715.91
7.1.100.0040.00717.09
7.1.90.0040.00415.42
7.1.80.0090.00316.00
7.1.70.0070.00416.46
7.1.60.0250.00724.42
7.1.50.0170.01524.37
7.1.40.0230.01024.16
7.1.30.0230.01124.32
7.1.20.0260.01024.35
7.1.10.0150.00915.30
7.1.00.0130.01315.29
7.0.330.0090.00315.48
7.0.320.0060.00615.20
7.0.310.0070.00715.27
7.0.300.0030.00915.45
7.0.290.0000.01515.43
7.0.280.0060.00915.40
7.0.270.0040.00715.42
7.0.260.0070.01015.55
7.0.250.0090.00315.43
7.0.240.0060.00815.48
7.0.230.0030.00615.55
7.0.220.0060.00615.45
7.0.210.0030.01415.38
7.0.200.0210.00515.29
7.0.190.0190.00515.06
7.0.180.0170.00914.91
7.0.170.0170.01314.94
7.0.160.0200.00514.82
7.0.150.0150.01114.98
7.0.140.0150.00815.01
7.0.130.0130.01615.19
7.0.120.0080.01714.97
7.0.110.0150.00615.00
7.0.100.0520.00914.97
7.0.90.0140.00815.08
7.0.80.0100.01214.82
7.0.70.0150.00915.14
7.0.60.0250.00714.96
7.0.50.0150.00814.96
7.0.40.0190.00714.08
7.0.30.0120.01013.99
7.0.20.0160.00914.05
7.0.10.0170.00714.05
7.0.00.0140.00913.95
5.6.400.0070.00414.42
5.6.390.0030.01314.26
5.6.380.0030.01114.29
5.6.370.0100.00614.76
5.6.360.0040.00714.68
5.6.350.0100.00014.63
5.6.340.0130.00014.38
5.6.330.0040.00814.73
5.6.320.0030.01014.18
5.6.310.0060.00614.23
5.6.300.0040.01414.61
5.6.290.0040.01014.63
5.6.280.0060.00314.28
5.6.270.0070.00714.26
5.6.260.0000.01114.37
5.6.250.0070.00714.39
5.6.240.0030.01014.31
5.6.230.0090.00014.80
5.6.220.0080.00414.32
5.6.210.0030.01114.44
5.6.200.0030.01014.45
5.6.190.0000.01514.56
5.6.180.0070.00414.37
5.6.170.0040.01214.24
5.6.160.0000.01314.41
5.6.150.0090.00314.18
5.6.140.0070.00714.69
5.6.130.0030.00914.35
5.6.120.0060.00914.57
5.6.110.0100.00014.30
5.6.100.0090.00614.64
5.6.90.0070.00314.50
5.6.80.0060.00614.29
5.6.70.0030.01014.36
5.6.60.0040.00714.00
5.6.50.0060.00614.10
5.6.40.0060.00314.50
5.6.30.0060.00914.45
5.6.20.0060.00314.29
5.6.10.0060.00814.45
5.6.00.0040.01113.99

preferences:
47.29 ms | 400 KiB | 5 Q